I'm not sure if I'm doing something wrong or is it a bug, but I can't get ExecLua to work.
My observation is that if you pass in the wrong type of variable (e.g. lua returns table, you pass in string), you only get an error, but it doesn't panic.
But if the types match (lua returns string, you pass in string) then the code panics.
I tried a bunch of pointer/no pointer, slice/slice pointer combinations with lua code with return and without.
Any help would be appreciated. Thanks.
A few examples:
var err error
// panics
var res string
err = v.ExecLua(`
function fn()
return "hi"
end
return fn()
`, &res)
// panics
err = v.ExecLua(`
function fn()
return "hi"
end
fn()
`, nil)
// panics
resSlice := make([]string, 1)
err = v.ExecLua(`
function fn()
return {"hi"}
end
return fn()
`, resSlice)
// doesn't panic
// err: msgpack: cannot convert ArrayLen to string
var res2 string
err = v.ExecLua(`
function fn()
return {"hi"}
end
return fn()
`, &res2)
Hi,
I'm not sure if I'm doing something wrong or is it a bug, but I can't get
ExecLua
to work.My observation is that if you pass in the wrong type of variable (e.g. lua returns table, you pass in string), you only get an error, but it doesn't panic. But if the types match (lua returns string, you pass in string) then the code panics. I tried a bunch of pointer/no pointer, slice/slice pointer combinations with lua code with
return
and without.Any help would be appreciated. Thanks.
A few examples:
This is the panic: