Lua API: renoise.tool().add_timer()


while working on my tool, i guess i stumbled over a bug in the API again.

when i try to use renoise.tool().add_timer(), i get an error message with code that used to work.

example code:

local func = function() print("timer triggered") end  
renoise.tool().add_timer(func, 10)  

error message:

*** No matching overload found, candidates:  
*** void add_timer(ScriptingTool&,luabind::object const&,custom [double])  
*** stack traceback:  
*** [C]: in function 'add_timer'  
*** main.lua:2: in main chunk  


EDIT: typo in test snippet and a different mistake led me to confusion. sorry. false alarm.

I didn’t even knew the API had a timer… i was always writing my own timer routines using os.clock ;)

Can confirm this one … whats wierd is that:

local func = function() print("timer triggered") end  
if not renoise.tool().has_timer(func) then   
 renoise.tool().add_timer(func, 10)  

… does actually work.
… nope it doesn’t ;)
… needs a colon to work indeed … embarrassing typo there (:

It’s “renoise.tool():add_timer” - note the !colon! behind tool() instead of the dot.

i am really embarrassed! duh! it’s not the first time. i thought i got used to the colon. it’s a mistake, but what actually made me think there is a problem, is not the typo in the code snippet i posted, but with code related to this function:

-- calls a function once after x ms  
function call_by_timer(func, ms)  
 local hook = nil  
 hook = function()  
 renoise.tool():add_timer(hook, ms)  

as you can see, minded the !colon! :lol: but it was actually another problem that caused the same error messsage. so actually two different mistakes lead to the same error message. anyway, sorry for the false alarm. it works as expected and i am embarrassed as crap, once again.