Open Lexicality opened 9 years ago
If I recall, command-line is executed one command after the other where-as in a file with a pointer is where Error would prevent the pointer from continuing down the file.
If this is a new issue from today then I can test on my dev-server to confirm ( last update was a few days to a week ago )....
If I recall, command-line is executed one command after the other where-as in a file with a pointer is where Error would prevent the pointer from continuing down the file.
The entire string is ran as a single block of code.
If I recall, command-line is executed one command after the other where-as in a file with a pointer is where Error would prevent the pointer from continuing down the file.
This is not the case. You can see by the fact that "why" is not printed to console, and also the fact that I know about this to start off with. (Unless you regularly type random functions into console to check that they work?)
Then I stand corrected in terms of the behavior!
It appears the same behavior is on my end ( dev version, last update a few days to a week ago ). ErrorNoHalt and Error allow the next command to output while error prevents this; both using lua_run... I use lua_run, rarely, when testing certain functionality without triggering auto-refresh...
If ran as a single block of code, then this is undesired behavior.
Edit: I just tested it in a file... Same results. Error failed to prevent the pointer from continuing whether called alone in a file or in a function called from the file.
If you're still not convinced that it's not an exciting variation caused by the console, try this
function test(foo)
if not foo then
Error("No foo provided!")
end
foo.bar()
end
test()
output:
] lua_openscript errortest.lua
Running script errortest.lua...
No foo provided!
[ERROR] lua/errortest.lua:5: attempt to index local 'foo' (a nil value)
1. test - lua/errortest.lua:5
2. unknown - lua/errortest.lua:7
I think this has been beyond confirmed :kiss: Same result in both branches.
3 years later and still no way to throw a halting error without the stack trace
It wasn't changed since June 2014 (as far as our commit history goes), but they indeed both run exactly the same code.
@Kefta why would you want to?
Because I'm making a Lua preprocessor that alters line count and function bounds so I need to print out my own stack trace.