Page 1 of 1
How to cal code from another card/stack
Posted: Tue Dec 23, 2014 8:54 am
by neatgadgets
I was wanting to have database connection and disconnection code in a stack (or card) and be able to call it from any card. I've found a number of options but none seem to work.
Example:
on dbConnect
insertcode here
end dbConnect
to call it I have tried
call dbConnect from card "cardname"
I also tried just calling it given the card should be able to access anything in the stack
Re: How to cal code from another card/stack
Posted: Tue Dec 23, 2014 11:13 am
by SparkOut
if you have th dbConnect handler in the stack script, then from any card in the stack, you can just:
dbConnect
as a statement which will fire a message to seek the dbConnect handler.
No need for "call" or "from". For great information about how the message path works, see:
http://www.fourthworld.com/embassy/arti ... _path.html
Re: How to cal code from another card/stack
Posted: Tue Dec 23, 2014 3:00 pm
by dunbarx
Hi.
What Sparkout said about just sending the message "dbConnect".
But read the dictionary entry on "call". The syntax does not allow the use of the word "from". Rather, it requires either no object identifier, or "of" and a valid identifier.
The danger of LC is that the language is so English-like, that it appears that what is logically and grammatically correct should also be syntactically correct. Not often, as we see here.
Craig Newman