Syntax Error in Lua
I've been having an error in lua that I have no idea how to fix. I thought I might get some help here.
Here is the code:
And here is the error:
Does anybody have any ideas?
Here is the code:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("mineraltrees:irontree", {
tiles = {"default_tree_top.png", "default_tree_top.png", "mineraltrees_irontree.png"},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
})
minetest.register_node("mineraltrees:ironsapling", {
description = "Ironwood Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
tiles ={"mineraltrees_ironsapling.png"},
inventory_image = "mineraltrees_ironsapling.png",
wield_image = "mineraltrees_ironsapling.png",
paramtype = "light",
walkable = false,
groups = {snappy=2,dig_immediate=3,attached_node=1},
})
minetest.register_node("mineraltrees:ironleaves", {
description = "Ironwood Leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tiles ={"mineraltrees_ironleaves"},
paramtype = "light",
is_ground_content = false,
groups = {snappy=3},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'mineraltrees:ironsapling'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'mineraltrees:ironleaves'},
}
}
},
})
function fill_rect(node, pos1, pos2)
for i = pos1.x,pos2.x do
for j = pos1.y,pos2.y do
for k = pos1.z,pos2.z do
minetest.set_node({x = pos1.x+i, y = pos1.y+j, z = pos1.z+k}, node)
end
end
end
function grow_giant_tree(wood_block, leaves_block, pos)
mineraltrees.fill_rect(wood_block, {x = pos.x-1, y = pos.y, z = pos.z-1})
end
minetest.register_abm({
nodenames = {"mineraltrees:ironsapling"},
interval = 30,
chance = 1,
action = funtion(pos, node)
print("Ironwood sapling grew into tree at " .. minetest.pos_to_string(pos))
mineraltrees.grow_giant_tree({name = "mineraltrees:irontree"},
{name ="mineraltrees:ironleaves"}, pos)
end
})
And here is the error:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
08:15:00: ERROR[main]: ========== ERROR FROM LUA ===========
08:15:00: ERROR[main]: Failed to load and run script from
08:15:00: ERROR[main]: C:\apps\minetest\minetest-0.4.10\bin\..\mods\mineraltrees\init.lua:
08:15:00: ERROR[main]: ...netest\minetest-0.4.10\bin\..\mods\mineraltrees\init.lua:61: '}' expected (to close '{' at line 56) near 'print'
08:15:00: ERROR[main]: ======= END OF ERROR FROM LUA ========
08:15:00: ERROR[main]: Server: Failed to load and run C:\apps\minetest\minetest-0.4.10\bin\..\mods\mineraltrees\init.lua
08:15:00: ERROR[main]: ModError: ModError: Failed to load and run C:\apps\minetest\minetest-0.4.10\bin\..\mods\mineraltrees\init.lua
Does anybody have any ideas?