lua-users home
lua-l archive

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



The way I "understand things" standard usage of Lua is to open a Lua state,
load up the libraries that you want, and then for fine grained control, pick
out the library bits that you don't like by just setting them to nil.  If
you want finer control still (i.e. runtime control of what functions are
available) then why not just store references to the questionable functions
off in the registry and set the "normal" references to nil, and copy them
back from the registry when needed.  If you don't like user scripts
exploding on nil references then you could substitute stub versions of the
functions that return an appropriate error code.

This way there are no "security checks" (though obviously calling the
enable/disable operations introduces overhead).

Just curious. :-)

Well, the main reason I hadn't done it that way was because it hadn't occurred to me... (I'm not an expert lua programmer, 'just' a C/C++ programmer, so some of the lua 'features' like this are new to me ;-) )

Thanks for the ideas.


Paul				VPOP3 - Internet Email Server/Gateway
support@pscs.co.uk			http://www.pscs.co.uk/