Murga-Projects Forums
possible callback inconsistency? - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: possible callback inconsistency? (/showthread.php?tid=20)

possible callback inconsistency? - mikshaw - 05-17-2007 09:13 AM

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?

RE: possible callback inconsistency? - dvw86 - 05-19-2007 03:34 PM

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