It looks like you're new here. If you want to get involved, click one of these buttons!
Timer._originalDelayedCall = Timer.delayedCall Timer.delayedCall = function(delay, func, ...) Timer._originalDelayedCall(delay, function() func(unpack(arg)) end) end
You could make your own while you wait for Atilim:Timer._originalDelayedCall = Timer.delayedCall Timer.delayedCall = function(delay, func, ...) Timer._originalDelayedCall(delay, function() func(unpack(arg)) end) end
function test(a, b, c) print(a, b, c) end Timer.delayedCall(1000, function() test(1, 2, 3) end)
http://www.luafaq.org/#T1.23I think the way I used it is not deprecated, but according to the faq it's not robust in the case where one if the arguments is nil?
Timer._originalDelayedCall = Timer.delayedCall Timer.delayedCall = function(delay, func, ...) local arg = {...} Timer._originalDelayedCall(delay, function() func(unpack(arg)) end) end
Timer.oldDelayedCall = Timer.delayedCall Timer.delayedCall = function(delay, func, ...) local arg = {n=select('#', ...), ...} Timer.oldDelayedCall(delay, function() func(unpack(arg)) end) end function test(data1, data2, data3, data4) print("GOT DATA:" , data1, data2, data3, data4) end Timer.delayedCall(4000, test, 4, 5, nil, "hello")
Comments
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Is arg deprecated?
https://sites.google.com/site/xraystudiogame
I think the way I used it is not deprecated, but according to the faq it's not robust in the case where one if the arguments is nil?
From this thread, he said arg does not work in lua 5.2,although it works in 5.1
http://stackoverflow.com/questions/9786051/getting-arg-to-work-in-a-varag-function-in-lua-5-2-integrated-in-delphi
https://sites.google.com/site/xraystudiogame
https://sites.google.com/site/xraystudiogame
My apps: http://www.yummyyellow.com