lua-users home
lua-l archive

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



Hi Tom,

On this day of 6-16-2006 8:49 AM, Tom Miles saw fit to scribe:

The reason I am doing this is to create a Lua script environment for some end users. The point of the exercise is to create a simplistic environment in which they can write small lua script functions to perform operations on C objects. I could just cut and paste some Lua code to do the job, but then every script that gets written (and there are going to be lots) would need to import a library script. I'm not keen on that approach if it can be avoided.


Could you not load the script yourself (via a loadstring or dobuffer or similar) when you create the Lua_State from the C API? That way, it is imported, but the end-users don't have to worry about it. I don't know if it's the most elegant solution or the "Lua Way" of doing things, but I had a similar problem as you and this is how I solved it.

Best,
- David

--
~David-Haley
http://david.the-haleys.org