News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
possible callback inconsistency?
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
possible callback inconsistency?

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:

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

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:

Code:
button:callback(funk)

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

Code:
button:callback(
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:

Code:
button:callback(funk("hay","bee","sea"))

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?

05-17-2007 09:13 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
possible callback inconsistency? - mikshaw - 05-17-2007 09:13 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: