kyren / piccolo

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

Implement `table.insert` and `table.remove` #87

Closed Aeledfyr closed 2 months ago

Aeledfyr commented 2 months ago

This now includes a reasonable set of tests, though the edge cases of the optimized case may be difficult to trigger explicitly.

kyren commented 2 months ago

This is really good work, thank you so much!

We talked about this a bit in chat, but there's some API changes I want to make to the raw table portion. Mostly, I don't want RawTable to have an API which only makes sense to use as part of the stdlib, so I'd like to change it to be more useful generally.. I'd like it to go ahead and correctly insert / remove and shift even when there are indexes in the map portion of the table.

This change is very good though, so I want to go ahead and merge it, and those changes can be done in a separate commit.

Thank you again!