[tl;dr]TIL: Lua error messages are useless and Minetest mods aren’t completely parsed before execution :)
Casimir wrote:Maybe post a part of your code, so the problem becomes clear.
While messing around I noticed that mods seem not to be parsed completely before executed.
So while …
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_on_joinplayer(function(player)
minetest.after(6, doStuffHere)
end)
function doStuffHere()
-- doing some random stuff here and call the timer again
minetest.debug(os.date('%X')..': doStuffHere being executed')
minetest.after(6, doStuffHere)
end
… prints
[the current time]: doStuffHere being executed every 6 seconds as expected …
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.after(6, doStuffHere)
function doStuffHere()
-- doing some random stuff here and call the timer again
minetest.debug(os.date('%X')..': doStuffHere being executed')
minetest.after(6, doStuffHere)
end
… breaks with a pretty useless error message telling me about an
Invalid core.after invocation […] in function 'assert'. instead of telling me that
doStuffHere() was not recognized/defined.
Because when I use …
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
function doStuffHere()
-- doing some random stuff here and call the timer again
minetest.debug(os.date('%X')..': doStuffHere being executed')
minetest.after(6, doStuffHere)
end
minetest.after(6, doStuffHere)
… it works as expected.
I just was confused about the error message and thought the timer has to be registered with something.