forked from minetest-mods/MoreMesecons
luablock: add a "pos" table in env containing the LuaBlock position
This commit is contained in:
parent
f44bdbfb36
commit
8c267be40d
@ -98,6 +98,9 @@ minetest.register_node("moremesecons_luablock:luablock", {
|
|||||||
make_formspec(meta, pos)
|
make_formspec(meta, pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local env = _G
|
||||||
|
env.pos = table.copy(pos)
|
||||||
|
setfenv(func, env)
|
||||||
local good, err = pcall(func)
|
local good, err = pcall(func)
|
||||||
-- Still alive! No shutdown requested? No infinite loop?
|
-- Still alive! No shutdown requested? No infinite loop?
|
||||||
if not good then -- Runtime error
|
if not good then -- Runtime error
|
||||||
|
Loading…
Reference in New Issue
Block a user