Code: Select all
local pos = {x=1,y=2,z=3}
local str = "hello world"
minetest.after(3.5, function(pos, str)
print("3.5 seconds later, we can do " .. str .. " at " .. minetest.pos_to_string(pos))
end, pos, str)
Code: Select all
local pos = {x=1,y=2,z=3}
local str = "hello world"
minetest.after(3.5, function()
print("3.5 seconds later, we can do " .. str .. " at " .. minetest.pos_to_string(pos))
end)
Code: Select all
local pos = {x=1,y=2,z=3}
local str = "hello world"
minetest.after(3.5, function()
print("3.5 seconds later, we can do " .. str .. " at " .. minetest.pos_to_string(pos))
end, pos, str)
Both tree work the same.
But sometimes I have issues with minetest.after when the vars are passed and, before the after function is run, they changed.
I mean, in the example above, if the var pos i.e changed to another value, what is the printed value, the new or the old (passed) one? What are passed to minetest.after, the vars or the values?