Hi everyone,
I would like to know how pass a function as a parameter for another function.
Thanks!
Hi everyone,
I would like to know how pass a function as a parameter for another function.
Thanks!
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("\
function a1 called")
end
function a2()
print("\
function a2 called")
end
Yes, perfect!
Thanks!