[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: making a set of functions available to all scripts
- From: Thomas Lauer <thomas.lauer@...>
- Date: Thu, 08 Nov 2007 17:09:58 +0000
Luo Hei <email@example.com> wrote:
> Terry Bayne escribió:
> > The way I usually do this is to embedded the functions in the host application, and then register those functions with the Lua engine. That way they are available for all scripts and are "pre-loaded".
> You mean writing the functions in C? I think it is not a solution. The
> functions must be written in Lua. At least, I think so.
> Perhaps I can put all functions in a file and execute it before all
> other scripts?
Look into the environment variable LUA_INIT.
Example: set this to "require('mystuff')" and Lua will automatically
load module mystuff before anything else. Calling dofile() inside
LUA_INIT would be another possibility.
web : http://thomaslauer.com/start