Page 1 of 1

[Confused] Registering tools using ipairs fails

PostPosted: Sat Apr 19, 2014 18:11
by SegFault22
I made this code:
Code: Select all
local tools = {
    { "metalores:pick_bronze", "Bronze Pickaxe", "metalores_pick_bronze.png", "1.0", "cracky = {times={[1]=2.40, [2]=2.00, [3]=1.60}, uses=32, maxlevel=3}", "fleshy=5" },
}

for _, row in ipairs(tools) do
    local toolid = row[1]
    local toolname = row[2]
    local toolimg = row[3]
    local toolswingspeed = row[4]
    local toolgroupcaps = row[5]
    local tooldamagegroups = row[6]

    minetest.register_tool(toolid, {
        description = toolname,
        inventory_image = toolimg,
        tool_capabilities = {
            full_punch_interval = toolswingspeed,
            max_drop_level=3,
            groupcaps=toolgroupcaps,
            damage_groups = tooldamagegroups,
        },
    })
end

But it's not working. The tool is registered, but it fails to break stone, or anything for that matter. What gives?

PostPosted: Sat Apr 19, 2014 18:41
by Krock
Code: Select all
local tools = {
    { "metalores:pick_bronze", "Bronze Pickaxe", "metalores_pick_bronze.png", 1.0, {cracky = {times={[1]=2.40, [2]=2.00, [3]=1.60}, uses=32, maxlevel=3}}, {fleshy=5} },
}

Take this.

PostPosted: Sat Apr 19, 2014 18:43
by SegFault22
I didn't think of that. Thank you.