On master, this test I wrote fails
pub fn metatable_test() {
let lua = glua.new()
let table = glua.table([])
let proxy = glua.function(fn(lua, _args) { #(lua, [glua.string("three")]) })
let metatable = glua.table([#(glua.string("__index"), proxy)])
let assert Ok(#(lua, _)) =
glua.ref_call_function_by_name(lua, ["setmetatable"], [table, metatable])
let assert Ok(lua) = glua.set(lua, ["number_table"], table)
let assert Ok(#(_lua, ["three"])) =
glua.eval(
lua,
"return number_table.itshouldntmatterwhatiputhere",
decode.string,
)
}
with
let assert test/glua_test.gleam:23
test: glua_test.metatable_test
code: let assert Ok(#(_lua, ["three"])) =
glua.eval(
lua,
"return number_table.itshouldntmatterwhatiputhere",
decode.string,
)
value: Error(UnexpectedResultType([DecodeError("String", "Nil", [])]))
info: Pattern match failed, no pattern matched the value.
Previously on 1.1.3, this test succeeded
pub fn metatable_test() {
let lua = glua.new()
let #(lua, table) = glua.table(lua, #(glua.string, glua.string), [])
let #(lua, proxy) =
glua.function(lua, fn(lua, _args) {
let #(lua, str) = glua.string(lua, "three")
#(lua, [str])
})
let #(lua, metatable) =
glua.table(lua, #(glua.string, fn(lua, val) { #(lua, val) }), [
#("__index", proxy),
])
let assert Ok(#(lua, _)) =
glua.ref_call_function_by_name(lua, ["setmetatable"], [table, metatable])
let assert Ok(lua) = glua.set(lua, ["number_table"], table)
let assert Ok(#(_lua, ["three"])) =
glua.eval(
lua,
"return number_table.itshouldntmatterwhatiputhere",
decode.string,
)
}
Please keep the simplified encoders since the 1.1.3 one was annoying to write.
On master, this test I wrote fails
with
Previously on 1.1.3, this test succeeded
Please keep the simplified encoders since the 1.1.3 one was annoying to write.