Getting LUA error msg

BlitzMax Forums/BlitzMax Beginners Area/Getting LUA error msg

Does any of you know how to store a LUA function in my field?
I've tried to use lua_tocfunction() but can't get it to really work...
What I basically want to do is have a button in BlitzMax as the type Gadget with a field called Func() and then in LUA do something like

function Clicked()
print("Hey!")
end

gadgetfunction(Clicked)

Which would set my Func() field into the LUA function Clicked(), then when I click the button just call Func()

I guess what I'm asking is... how do I pass a function as a parameter in LUA?