kyren / piccolo

An experimental stackless Lua VM implemented in pure Rust
Creative Commons Zero v1.0 Universal
1.62k stars 59 forks source link

Mirror `__index` change to `__newindex` #70

Closed Jengamon closed 3 months ago

Jengamon commented 3 months ago

realized this should be the case from Lua 5.4 manual:

Like with indexing, the metavalue for this event can be either a function, a table, or any value with an newindex metavalue. If it is a function, it is called with table, key, and value as arguments. Otherwise, Lua repeats the indexing assignment over this metavalue with the same key and value. This assignment is regular, not raw, and therefore can trigger another newindex metavalue.

kyren commented 3 months ago

yeah that makes sense