lua-users home
lua-l archive

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


anderson wrote:
I have some scripts that may be ran many times, in one program execution.
I'd like to keep them in memory (RAM) in the lua complied state. How do I do
that?

I know I can use lua_dostring to execute strings I have in memory, but I'd
also like to use the lua complied codes instead.

Ideally, wrap the code in these scripts in functions (if it isn't
aren't already).  Then, you can run the script (which will
'define' its functions) and throw the script away; compiled
versions of the functions in that script are now by default sitting in
the globals table of your lua state and you can run them out of
there as you desire.

--Adam
--
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
"When I was young, I would break down and cry whenever mom made me
throw an empty toilet paper tube in the trash can. I just imagined
it sitting at the dump, all cardboard and sad." -- T.Farnon