-
3 votesanswersviews
Lua setfenv / metatable sandbox不适用于ROBLOX方法
在ROBLOX Lua中,我正在编写一个涉及用户创建和运行Lua脚本的游戏 . 显然,我需要阻止使用某些服务和函数,例如Player类上的Kick函数,或者与DataStore或TeleportService相关的任何东西 . 到目前为止,我已经成功地通过使用setfenv将函数的环境设置为metatable来创建沙盒环境,metatable附加到“沙箱”表 . 在__index上,如果在沙箱表中... -
11 votesanswersviews
为什么Python在实例创建时调用实例方法__init __()而不是调用类提供的__init __()?
我正在覆盖类的 __new__() 方法,以返回具有特定 __init__() 集的类实例 . Python似乎调用类提供的 __init__() 方法而不是特定于实例的方法,尽管Python文档在 http://docs.python.org/reference/datamodel.html 说: 典型实现通过使用具有适当参数的super(currentclass,cls).__ new _... -
0 votesanswersviews
Google计算引擎列表/实例删除失败正则表达式
我创建了一个名为primecoin01的Google计算引擎永久磁盘的私有映像 . 后来,我'm trying to create a new image. It fails by saying the regexp is invalid both in listing the images and during gcloud.compute.instances.delete - the 1st ...