如何限制 lua 的可能性(调用 OS 函数、模块等) [英] How can I limit lua possibilities (calling OS functions, modules, etc.)

查看:9
本文介绍了如何限制 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 上的 Simple Sandbox: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 讨论:

这篇关于如何限制 lua 的可能性(调用 OS 函数、模块等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆