Lua中如何正确运用--- __newindex实现自定义索引操作?
- 内容介绍
- 文章标签
- 相关推荐
本文共计247个文字,预计阅读时间需要1分钟。
1. 当 `__newindex` 是一个函数时,在给 `table` 不存在的字段赋值时,会调用这个函数。
2.如果 `__newindex` 是一个 `table`,在给 `table` 不存在的字段赋值时,会直接给 `__newindex` 的 `table` 赋值。
本文共计247个文字,预计阅读时间需要1分钟。
1. 当 `__newindex` 是一个函数时,在给 `table` 不存在的字段赋值时,会调用这个函数。
2.如果 `__newindex` 是一个 `table`,在给 `table` 不存在的字段赋值时,会直接给 `__newindex` 的 `table` 赋值。

