alex at tweedly.net
Fri Nov 30 15:15:52 EST 2018
Hmmm I hesitated to reply earlier, just in case there are subtleties I
might get wrong and mislead you - but here goes.
include / require are essentially ways to include the text of the
included file. Include will do that - and do it every time you use it ....
so you could have a trivial nonsensical example like ...
mydebug.lc - a file which will dump out a bunch of variable info ...
> <? rev
> put "Data is:" && gVar1 && gVar2 && gArray[temp]
and use it as
doSomeHandler gVar1, 17
-- and check what the current status is now
-- and check again
note that you can now change the file to do any other logging you might
want, and each occurrence will be changed.
NB - I have never used 'include' except in a few places where I should
have used require :-)
And I've never wanted to use it as I just described :-) :-)
require is similar, but the file contents will only be inserted the
*first* time; so it's useful to include the source of library-like
functions. And you don't need to worry if you do this in multiple
places. I used to use this a lot.
Note that include and require are both specific to LC server. I
basically no longer use them, now that we have script-only stacks. I now
develop 99% of all LC server functionality as script-only stacks,
testing in either the IDE or via LCServer as needed. And for this, you
use "start using" just like in the IDE world.
P.S. Note - there are (I think) strange subtleties in using globals
and/or script locals in include'd / require'd files - very confusing,
and I suspect it's a bug - but couldn't quite come up with a reliable
mental model or example; that was when I just converted to script-only
On 30/11/2018 16:26, Ralph DiMola via use-livecode wrote:
> Ahh... I see that the revIgniter library is the way to go for my number 2
> question and I am immersed in the docs. But I'm still wondering about my
> question # 1 (differences between "Include", "Require" and "Start using")
> I've been using LiveCode Server for a few years now with great success as
> various web services from LCS. I started this when I was a relative newbie.
> I access my library stacks via "Start using".
> 1) Can anyone shed some light on the subtle differences between "Include",
> "Require" and "Start using"? The docs are not clear to me.
> I'm starting a new project using interactive web pages. I have an in house
> web designer that I need to show how to call LC server scripts to populate
> web pages. I would rather use LC Server and MySQL and my on-staff html
> designer rather than sub it all out using vb.net and SQL server.
> 2) Are there any examples of how to do this?
> Thanks in advance.
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode