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 while ago I opened an issue about not getting an expected error message back from the lua instance and closed it because it happened to work properly for some reason when I went to try again. I've now ran into a problem where most of my error messages are matching up to what I would expect, however a particular type of error seems to be breaking the normal expected output.
Working Example:
Luam_lua=new Lua();stringlua_script=@" local function add(a, b) return a + b end local function mult(a, b) return a * b end local result = add(5, "something")
print(result)";try{
m_lua.DoString(script);}catch(Exceptionex){
Console.WriteLine(ex.Message);}
Expected (lua interpreter)
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
> function add(a,b)
>> return a+b
>> end
> result = add(10, "something")
stdin:2: attempt to add a 'number' with a 'string'
stack traceback:
[C]: in metamethod 'add'
stdin:2: in function 'add'
stdin:1: in main chunk
[C]: in ?
Result (from c#)
[string "chunk"]:2: attempt to add a 'number' with a 'string'
stack traceback:
[C]: in metamethod 'add'
[string "chunk"]:2: in local 'add'
[string "chunk"]:5: in main chunk
As you can see, it lines up fairly well.
Failing Example:
Now the case that I have found that does not work as expected, is when I do the following:
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
> some_function_that_does_not_exist()
stdin:1: attempt to call a nil value (global 'some_function_that_does_not_exist')
stack traceback:
stdin:1: in main chunk
[C]: in ?
Result (from c#)
[string "chunk"]:12: C stack overflow
stack traceback:
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
... (skipping 177 levels)
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:12: in metamethod 'index'
[string "chunk"]:2: in main chunk
I'm wondering if there is something I am missing in this very simple example. Or if this is just one of those edge cases that I've stumbled into.
Let me know if I need to provide more information in regards to this problem. It's not a major issue at the moment and a workaround I might implement at some point if I don't get a resolution here will be to regex for the pattern and override the message.
The text was updated successfully, but these errors were encountered:
Preface
I while ago I opened an issue about not getting an expected error message back from the lua instance and closed it because it happened to work properly for some reason when I went to try again. I've now ran into a problem where most of my error messages are matching up to what I would expect, however a particular type of error seems to be breaking the normal expected output.
Working Example:
Expected (lua interpreter)
Result (from c#)
As you can see, it lines up fairly well.
Failing Example:
Now the case that I have found that does not work as expected, is when I do the following:
Expected (lua interpreter)
Result (from c#)
I'm wondering if there is something I am missing in this very simple example. Or if this is just one of those edge cases that I've stumbled into.
Let me know if I need to provide more information in regards to this problem. It's not a major issue at the moment and a workaround I might implement at some point if I don't get a resolution here will be to regex for the pattern and override the message.
The text was updated successfully, but these errors were encountered: