Murga-Projects Forums

Full Version: possible callback inconsistency?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm not sure if I'm just misunderstanding the logic in using callbacks, if there's something I'm overlooking, or if there is an inconsistency.

Let's assume you have the following pseudo function:

function funk(a,b,c)
do a command
maybe do something else

Now assume a button named "button", which is used to call funk. If you don't use any parameters, you can set it up like this:


If you need to use funk's parameters, you apparently must create a second function to use as the callback, like this for example:

function(button) funk("hay","bee","sea") end

If this seemingly redundant function is not created, the callback is done immediately when the application runs. This occurs if the callback is create like this:


It doesn't seem logical or consistent to have to change the way a callback is defined just because you want to pass a parameter to the function. It also seems unnecessary to create a function in order to call a function.
Am I missing something? Maybe I've been defining callbacks incorrectly?

I've noticed the same thing. I don't believe that "pure" Lua acts that way though.
Reference URL's