difference between function and command and sending parameters
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Fri Oct 17 11:32:43 EDT 2008
Bonjour William,
Le 17 oct. 08 à 17:08, william humphrey a écrit :
> 2. why would anyone use the function thing when they can use a
> command with
> a parameter. What good is a function? I guess when you want multiple
> parameters?
Functions are useful and handy because their main purpose is to
return a value:
set the enabled of group "Commands" to ThereIsAPilot() --
function ThereIsAPilot
return "William" is among the lines of CurrentUsers() --
-- returned value will be a Boolean (TrueOrFalse)
end ThereIsAPilot
function CurrentUsers
return fld "Users" of card "Reference"
-- returned value will be a list of lines
end CurrentUsers
Etc.
Consider this just to understand how it works.
Actually commands can return a value also (using the result... that
is actually a function :-) but it's less handy.
More generally, think about commands (on, command) when this will
lead to a result visible by the user in your GUI.
And think about functions to get values you need to achieve a process.
There would be hundred of pages to write about commands versus
functions: see the user guide p. 121 and after.
About F and H used in Rev 3.x script editor in lists, I assume that H
means 'handler' and could be considered as incorrect since a function
is a handler as commands are :-)
And, after having verified, Rev docs name commands handlers...
Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------
More information about the use-livecode
mailing list