[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Question about loading Lua files from within Lua files
- From: pixellent@...
- Date: Thu, 19 Dec 2002 22:33:30 -0500
I've been reading some messages in the mailing list archives, but I can't
determine if the following is possible. I'd like to load a (ultimately compiled)
Lua file from within another Lua file.
For example hello.lua contains a function called Hello(), which is available to
the C++ application. The first thing hello.lua does is load goodbye.lua using
dofile("goodbye.lua").
goodbye.lua contains a function Goodbye().
So I'd like the application to call Hello() and Hello() then calls Goodbye().
>From my testing, I can't get this to work. If I load another script file from
with a Lua file, is this in the same "namespace" (I use the word namespace
liberally, as I'm not sure how Lua deals with namespaces yet).
Essentially I want the C++ application to load the top level script file (say
main.lua), which then loads/compiles any number of other script files. I want to
have the variables and functions in these other scripts available to all of the
other functions and variables that were also loaded. Is this possible, and am I
on the right track with using dofile within a script?
Thanks
Mike