dofile doesn't work from callback funcion
Posted: Sun Jul 29, 2018 5:56 pm
I have a createUDPsocket with related callback function:
If I put a dofile in the callback like this:
it is not executed or has no effect.
If it is called like this:
it works - lcdprint is executed.
Can anyone explain why?
Code: Select all
s=net.createUDPSocket()
s:on("receive",function(s,c)
---snip---
end)
If I put a dofile in the callback like this:
Code: Select all
s=net.createUDPSocket()
s:on("receive",function(s,c)
---snip---
dofile("lcdprint.lua").lcdprint("Testing-1-2-3--",4,0)
---snip---
end)
it is not executed or has no effect.
If it is called like this:
Code: Select all
s=net.createUDPSocket()
s:on("receive",function(s,c)
---snip---
tmr.alarm(4, 1000, 1, function() dofile("lcdprint.lua").lcdprint("Testing-1-2-3--",4,0) end )
---snip---
end)
it works - lcdprint is executed.
Can anyone explain why?