Parameters for functions and commands

Ralph DiMola rdimola at evergreeninfo.net
Thu Jan 4 16:57:01 EST 2018


T,

Non functions don't need the parens. You are actually are passing 1 parameter of "2,3"
When you do a "put DoStuff_2 (2,3)" LC is looking for a function DoStuff_2 that does not exist.
If you do "DoStuff_2 2,3" you will get the expected results.
Also if a  non function does a "Return somevar" the value of somevar with be in "the result"

Example:

On DoStuff3 a,b
Return A
End DoStuff3

The if you do this in another handler

Dostuff3 2,3
Answer the result

You will see "2"

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Thomas von Fintel via use-livecode
Sent: Thursday, January 04, 2018 4:30 PM
To: use-livecode at lists.runrev.com
Cc: Thomas von Fintel
Subject: Parameters for functions and commands

I am well aware that I shouldn't expect *everything* in Livecode to be intuitive, but this one bugs me:

Having a handler like

    function DoStuff_1 a, b

       return a

    end DoStuff_1

When you do "put DoStuff_1 (2,3)" the result is 2.

But with

    on DoStuff_2 a, b

        put a

    end DoStuff_2

The result of DoStuff_2 (2, 3) is 2,3. "put a*b" produces an error.

This means, parameters are passed differently to command handlers and function handlers. Right?

Is that the way it should be and why?


Thanks for your patience

Thomas



_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list