__newindex API指在Lua中用于设置新索引的函数。

问题是如何通过 Lua C API 来完成以下功能:

settings.default.color = 10 --(引发错误)
persistent.channel.xxx = 15 --(调用函数进行设置)
y = persistent.channel.xxx --(调用函数进行读取)

原文链接 https://stackoverflow.com/questions/3942025

点赞
stackoverflow用户107090
stackoverflow用户107090

使用代理表。请参见http://www.lua.org/pil/13.4.4.html

2010-10-15 12:14:18