[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: call a function in other script from a script
- From: "Nguyen Dang Quang" <quangnd412@...>
- Date: Wed, 19 Jul 2006 12:23:59 +0700
My trouble is:
In File 2:
--call to other function in file 2
----------------------end of file 2------------
and in file 1, I do not know how to call the function main in file 2, and
file 2 will be create at run time or even load from database in to memory!
Please help me
[mailto:firstname.lastname@example.org] On Behalf Of Daniel Collins
Sent: Wednesday, July 19, 2006 12:15 PM
To: Lua list
Subject: Re: call a function in other script from a script
I generally use "require" to ensure visibility between different script
main() -- calls main defined in file1
You can also use "dofile" or "loadfile". It is worth reading the
reference manual and the Programming in Lua book to learn the
differences between all these approaches. The thing I like about require
is the way it ensures that each file is only loaded once. That way I can
use require at the top of every script in a similar way to using
#include in C/C++, just to make sure things are visible but without the
overhead of loading the files more than once.
[mailto:email@example.com] On Behalf Of Nguyen Dang
Sent: Wednesday, 19 July 2006 2:33 PM
Subject: call a function in other script from a script
In my LUA script, I have to call a function "main" in other scripts but
I do not know how to do that. Please help me.
In 2nd script:
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around