[Confused] Registering tools using ipairs fails

Post Reply
User avatar
SegFault22
Member
Posts: 870
Joined: Mon May 21, 2012 03:17
Location: NaN

[Confused] Registering tools using ipairs fails

by SegFault22 » Post

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?
Last edited by SegFault22 on Sat Apr 19, 2014 18:30, edited 1 time in total.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.

User avatar
Krock
Developer
Posts: 4538
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

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.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
SegFault22
Member
Posts: 870
Joined: Mon May 21, 2012 03:17
Location: NaN

by SegFault22 » Post

I didn't think of that. Thank you.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests