Shared functions?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Shared functions?

Post by exheusden » Fri Jan 08, 2010 2:21 am

Is there some equivalent in Revolution Media of shared functions, as used in SuperCard? Routines that might be useful in different projects, stored at a single place, outside those projects?

For example, I have a routine I use to convert characters in a passed text to HTML entities (perhaps this exists in some other form in RM, but it's just used as an example here) that I call from various places: handy when a change is needed.

(Aaarrgh, I wanted to see if a similar routine already existed in RM and it' went into beachball mode when I clicked on Dictionary. Why does this happen so often?)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Shared functions?

Post by FourthWorld » Fri Jan 08, 2010 7:49 am

While Rev has no single shared library like SC's sharedScript, you can make any number of libraries and have them automatically brought into use at startup - see Development->Plugins

This article provides a summary of options for extending the Rev message path:


Extending the Runtime Revolution Message Path:
An introduction to using Libraries, FrontScripts, BackScripts and Behaviors
in Runtime Revolution's RevTalk Programming Language
http://fourthworld.com/embassy/articles ... _path.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Shared functions?

Post by exheusden » Fri Jan 08, 2010 11:34 am

Thank you for the reply. I'm using Revolution Media 4.0 and, although there is a menu Development, there is no men-item Plugins under it. I take it this is only available in the more advanced versions of Revolution.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Shared functions?

Post by FourthWorld » Fri Jan 08, 2010 6:17 pm

Ah yes, sorry I missed that this thread is in the RevMedia section.

Not sure why RevMedia doesn't provide a UI for plugins, but you can use any stack as a library and bring it into use by adding this line to the stacks you want to use it in:

start using "MyNiftyTools.rev"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Shared functions?

Post by exheusden » Fri Jan 08, 2010 9:48 pm

Okay!

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Shared functions?

Post by exheusden » Sat Jan 09, 2010 12:36 pm

MyNiftyTools.rev: I've searched RevOnLine and also done a Google search (which only brings up this thread), but can find no other reference to it.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Shared functions?

Post by bn » Sat Jan 09, 2010 1:06 pm

Exheusden,

MyNiftyTools.rev was supposed to be a placeholder name for any stack you want. Just create a stack, name it what you want, fill its stack script with the functions and commands you want as a library, then "start using ExheusdenNiftyTools.rev" stack. You might want to look up the message hierarchy in the user guide page 135, and in the dictionary the "start using", "stacksinuse" and the "See also" references for the respective keywords.
regards
Bernd

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Shared functions?

Post by exheusden » Sat Jan 09, 2010 1:29 pm

Excellent, Bernd. Works a charm. Thank you very much.

Post Reply