lua-users home
lua-l archive

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


John Hind [john.hind@zen.co.uk] wrote:
> I accept and value that Lua uses a trust model for containment, but it
is
> still better for "the right thing" to be easy to do and "the wrong
thing"
> to require some thought.

Lua uses no model for containment. It just provides mechanisms to create
your own. Default global environment is an empty table, so there is no
restriction to its access. You can override that mechanism easily (you
were given pointers to examples in a previous mail). You don't have to
trust other coders, you can easily confine their code to a well
controlled environment.

One of the strength of Lua is its homogeneity. Scripts, Lua functions
and C functions behave the same way. It uses tables everywhere theres is
a need for a special mechanism, allowing these mechanisms to interact
smoothly. A global variable access is in fact just the combination of an
upvalue access to _G and a table indexing. Upvalue binding to _G can be
modified through the setfenv function. Table indexing can be modified
with metamethods. You control everything, Lua only enforces the syntax
(which is pretty flexible).