LDCad setEvent, 'run' and passing parameters to macro?


RE: setEvent, 'run' and passing parameters to macro?
#2
(2021-09-25, 1:45)David Manley Wrote: with 1.7 scripting API in LDCad, is it possible to pass an argument to a macro when it is run?

Not at the moment.

I kept the callbacks simple (like in Javascript etc).

But the problem in your project can be handled using a global variable, like:

Code:
initTest=true

function runTest()

  if initTest then
    ldc.dialog.runMessage('init')
    initTest=false
  end
 
  ldc.dialog.runMessage('work')

end

function register()

  local macro=ldc.macro('test')
  macro:setEvent('run', 'runTest')
end

register()

Globals in any script will be preserved until the containing script is reloaded as each script runs in it's own environment.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: setEvent, 'run' and passing parameters to macro? - by Roland Melkert - 2021-09-25, 18:46

Forum Jump:


Users browsing this thread: 1 Guest(s)