Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Function as parameters

edited August 2012 in Questions Posts: 24

Hi everyone,

I would like to know how pass a function as a parameter for another function.



  • dave1707dave1707 Mod
    Posts: 8,496


    Is this what you're after.

    function setup()     a0(a1)    -- call function a0() passing function a1()     a0(a2)    -- call function a0() passing function a2() end function a0(func)     func()    -- execute passed function end function a1()     print("\nfunction a1 called") end function a2()     print("\nfunction a2 called") end
  • Posts: 24

    Yes, perfect!

Sign In or Register to comment.