lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


pixellent@stodge.net wrote:
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().


I am using Lua5(a/b) and function require instead of dofile, and what you
describe certainly works. I don't see why it shouldn't work with dofile too.
Any error or incorrect filename during the handling of the files might
surprise you of course.


			Eero