lua-users home
lua-l archive

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


>> hm.. actually, i would like to permit the user to introduce new functions
>> at his
>> caprice. Can i still put them in a sandbox automatically somehow?
>
> You do that when you load their code:
>
> code = loadfile ( "path/to/users.lua" ) -- Load user's code
> setfenv ( code , { print = print } ) -- Sandbox user code
> code ( ) -- Run user's code
>
> ^^ you load the user's script//code like this. you can do a similar thing
> from the C api too.

Ok, thanks, i guess that answers my questions. Thank you all for your help ~