[solved]bad eyes, cant find the problem, need help pls
i always get a error
init.lua:488: ')' expected (to close '(' at line 444) near 'if'
i really blind and already starring since hours on this code, i cant figure out where is the mistake...
can somebody give me a hint....
code is:
minetest.register_on_placenode(function(pos, newnode, placer)
if newnode.name == "deko:deko_wallbase" then
--param.2 detects the state that this object is placed in and stores it
local state = newnode.param2
--this makes the game generate a random number
local i = math.random(1,4)
--removes the dekobase
if minetest.env:remove_node(pos) then
--this statement tells the game if it stops on this number this painting will be selected
if i==1 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper1",param2=state})
end
if i==2 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper2",param2=state})
end
if i==3 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper3",param2=state})
end
if i==4 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper4",param2=state})
end
end
end
end
if newnode.name == "deko:deko_shieldbase" then
--param.2 detects the state that this object is placed in and stores it
local state = newnode.param2
--this makes the game generate a random number
local i = math.random(1,4)
--removes the dekobase
if minetest.env:remove_node(pos) then
if i==1 then
minetest.env:add_node(pos, {name="deko:deko_shield1",param2=state})
end
if i==2 then
minetest.env:add_node(pos, {name="deko:deko_shield2",param2=state})
end
if i==3 then
minetest.env:add_node(pos, {name="deko:deko_shield3",param2=state})
end
if i==4 then
minetest.env:add_node(pos, {name="deko:deko_shield4",param2=state})
end
end
end
)
init.lua:488: ')' expected (to close '(' at line 444) near 'if'
i really blind and already starring since hours on this code, i cant figure out where is the mistake...
can somebody give me a hint....
code is:
minetest.register_on_placenode(function(pos, newnode, placer)
if newnode.name == "deko:deko_wallbase" then
--param.2 detects the state that this object is placed in and stores it
local state = newnode.param2
--this makes the game generate a random number
local i = math.random(1,4)
--removes the dekobase
if minetest.env:remove_node(pos) then
--this statement tells the game if it stops on this number this painting will be selected
if i==1 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper1",param2=state})
end
if i==2 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper2",param2=state})
end
if i==3 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper3",param2=state})
end
if i==4 then
minetest.env:add_node(pos, {name="deko:deko_wallpaper4",param2=state})
end
end
end
end
if newnode.name == "deko:deko_shieldbase" then
--param.2 detects the state that this object is placed in and stores it
local state = newnode.param2
--this makes the game generate a random number
local i = math.random(1,4)
--removes the dekobase
if minetest.env:remove_node(pos) then
if i==1 then
minetest.env:add_node(pos, {name="deko:deko_shield1",param2=state})
end
if i==2 then
minetest.env:add_node(pos, {name="deko:deko_shield2",param2=state})
end
if i==3 then
minetest.env:add_node(pos, {name="deko:deko_shield3",param2=state})
end
if i==4 then
minetest.env:add_node(pos, {name="deko:deko_shield4",param2=state})
end
end
end
)