ceifa / wasmoon

A real lua 5.4 VM with JS bindings made with webassembly
MIT License
449 stars 29 forks source link

Unexpected behavior from arrays #78

Open itz-coffee opened 1 year ago

itz-coffee commented 1 year ago

Adding arrays to the environment leads to unexpected behavior:

env.set("array_test", ["a", "b", "c"]) await lua.doString(` table.remove(array_test, 2)

for k, v in pairs(array_test) do
    print(k, v)
end

`)

0 a 1 c 2 nil length 3

These issues do not happen when creating regular tables
```js
await lua.doString(`
    local table_test = {"a", "b", "c"}
    table.remove(table_test, 2)

    for k, v in pairs(table_test) do
        print(k, v)
    end
`)
1       a
2       c
ceifa commented 1 year ago

Checked and it only happens if enableProxy is true, I'm not sure if this is a bug

sirrobindoger commented 1 year ago

Why not add some documentation on that?