-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
在运行示例代码中,发现一处错误。
https://raw.githubusercontent.com/Tencent/xLua/master/Assets/XLua/Examples/12_ReImplementInLua/ReImplementInLua.cs
重新设置metatable之后,是无法直接修改vector3.x ...=>no such field x
原因是:
代码中__newindex 的方法中语法错误:
return fields_setters[k] and fields_setters[k](o, v) or error('no such field ' .. k)
而 set_x 是c function。

返回的结果个数是0 。
这个正好触发了lua 的三元操作的一个漏洞:
true and 空 or error.
此处空 非 nil. 会执行 error 的代码。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels