如何限制lua的可能性(调用OS功能,模块等)

问题描述:

我在我的C应用程序中使用Lua作为脚本语言.

I am using Lua as a script language inside my C application.

这很适合我,但是我不明白如何限制Lua不要调用系统功能,包括其他模块等.

It suits me well, but I can't understand how can I limit Lua not to call system functions, include other modules, etc.

我希望Lua只能调用我允许的功能,因为用户可以利用Lua + Lua模块的全部功能来做各种不好的事情.

I want Lua to be able to call only functions that are allowed by me, because user can do all kind of bad things with full Lua + Lua modules power.

在Lua-users Wiki上查看简单沙箱: http://lua-users.org/wiki/SandBoxes

Take a look at the Simple Sandbox on the Lua-users wiki: http://lua-users.org/wiki/SandBoxes

相关的SO讨论: