lua-users home
lua-l archive

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


Alain wrote:

> I want to include Lua scripts in screen objects. My
> concern is that I want to limit accessibility to too many
> LUA commands, I want to limit the commands that he can
> use.

If I understand what you're trying to do, it can be done
easily in stock Lua.  First use loadstring() to turn the
user's code into a function (this is where you catch any
syntax errors).  Then use setfenv() to keep the function
from accessing any dangerous globals.  This second step is
explained in section 14.3 of Programming in Lua:

<http://www.lua.org/pil/14.3.html>

-- 
Aaron