You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having some trouble that I think is being caused by luar's translation of my go functions.
panic:
[G]: bad argument #1 to Respond (userdata expected, got string)
stack traceback:
[G]: in Respond
test.lua:6: in main chunk
[G]: ?
test .lua is this:
synfunc = function (msg)
msg.reply("ack")
end
robot.Respond("syn",synfunc)
The general idea is that users will call robot.Respond with a regex they want to match, and a reference to a lua function they want to be called when the regex is detected by the upstream go program.
robot is a very simple struct type that enables the upstream Go to index this request back to the lua state that made it (there will be many):
type Robot struct{
ID int
}
the respond function on the go-side is also pretty simple:
As you can see in the error message, this panic's in runtime because the lua state seems to think my Respond function wants lua.LUserData instead of a string, which I assume(?) is probably being caused by luar's translation.
I've written some test scripts and I don't seem to be able to replicate this issue (methods on go structs with this signature (string,lval) seem to work in general), so I'm not sure if I'm doing something wrong in this codebase or if I've found a bug or what. You can take a look at the actual codebase here
Thanks in advance for your help.
-dave
The text was updated successfully, but these errors were encountered:
Hi,
This is a fantastic project thanks for it.
I'm having some trouble that I think is being caused by luar's translation of my go functions.
test .lua is this:
The general idea is that users will call robot.Respond with a regex they want to match, and a reference to a lua function they want to be called when the regex is detected by the upstream go program.
robot is a very simple struct type that enables the upstream Go to index this request back to the lua state that made it (there will be many):
the respond function on the go-side is also pretty simple:
As you can see in the error message, this panic's in runtime because the lua state seems to think my Respond function wants lua.LUserData instead of a string, which I assume(?) is probably being caused by luar's translation.
I've written some test scripts and I don't seem to be able to replicate this issue (methods on go structs with this signature (string,lval) seem to work in general), so I'm not sure if I'm doing something wrong in this codebase or if I've found a bug or what. You can take a look at the actual codebase here
Thanks in advance for your help.
-dave
The text was updated successfully, but these errors were encountered: