Closed BangL closed 6 years ago
BLT isn't responsible for implementing pcall()
, so it's likely possible that it has something to do with changes to PAYDAY
that's horrible, but good to know. any chance that this misbehaviour could be fixed by the blt?
I'm not sure.
It might be within the realm of possibility that the way we expose it is the problem . I'm not really a lua expert, or even novice, so I'm not sure.
I had this same problem, more or less.
Try using vm.pcall
, though you should make sure vm
and vm.pcall
exist first.
See #67
The broken version of pcall
is implemented in BLT4L - see lapi.cc:30.
Here's the behavior of the method, on both platforms:
true
, followed by all return values from the called function.I could fix the function to do what it is supposed to (we even have a copy of the correct function in lapi_vm.cc
), but I'm a little worried about having different behavior on BLT4W and BLT4L.
On the other hand, I can't imagine anyone relying on the non-nilness of the second argument to see if the function ran correctly. @BangL What do you think?
in fact i am totally relying on the second param. i am working on an ingame debug console mod, and it is the only way to show error messages in it. thats why i'm interested in it. the vm.pcall does exactly what i want, so i am perfectly happy now. thanks for the information about the vm table!
according to countless sources, pcall() should return exactly two values in case of an error: false and the error. this is pretty essential for proper error handling. since blt2 it does not seem to be implemented correctly and instead returns nothing at all. https://www.google.de/search?q=lua+pcall is this a problem on blt's side, or in the game itself?