lua-users home
lua-l archive

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


Hi,

thanks to all the feedback I got from this thread. I am making here a sumary where I will try to put it all toghether and see if it is reasonable. I started with a question about a small aspect (2) and got much more.

1) Link Lua static into my program. (this also helps Win/Lin portability stability and install)

2) I can edit llex.c and make a syntaticaly simpler Lua language. I will check if this can do what I want.

3) Remove from Lua all possibilty of loading modules and even functions from Lua code. This will probably require altering the code to remove "loadstring" , "loadlib" and "require" (maybe some others...)

4) Use one Lua state for each window. A window in the system is one entity where all objects colectively execute one single task. This will keep things independant and problems easier to track.

4) All general libs and functions will be pre-loaded by the C program. Then a new environment is created to protect all globals with setfenv(). Then all object functions are loaded, they can only access selected functions and variables declared as locals (last sniplet of http://www.lua.org/pil/15.4.html) I could even have a GLOB local to access the global environment only in debug mode.

5) All object scripts share the same environment. They comunicate with the outside world though C functions that access the Window properties and databases. A single return string sets the object's value if apprepriate. (I believe this is a kind os community sandboxing)

6) In the editing window for object scripts, I test the code with loadstring() to turn the user's code into a function (to catch any syntax errors). A few more filtering can be done (eg: GLOB access) only then I accept and store the code.

MISSING: all user data should be UTF8 :() how much far from Lua is LuaPlus? do you recomend it?

TODO: limit execution time. Mark Hamburg sent some info that I could not understand. FWIK it should be done inside the VM ... (?)

Alain