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


RE: setEvent, 'run' and passing parameters to macro?
#3
(2021-09-25, 1:45)David Manley Wrote: can a value be passed via the setEvent API

Side note:
I have been thinking about adding a single extra optional parameter to all the setEvent functions.

But it will be a table name so you could have something like:
Code:
test={
  doInit=true,
 
  init=function(self)
    print('init')
    self.doInit=false
  end,

  run=function(self)
    if self.doInit then
      self:init()
    end
   
    print('work')
  end
}

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

register()

To fake object oriented programming.
Reply
« Next Oldest | Next Newest »



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

Forum Jump:


Users browsing this thread: 1 Guest(s)