broken conditions like `enemy.hp < 1)` are not diagnosed
bloerwald opened this issue ยท 3 comments
A user submitted a script using
use (ability) [ cond & enemy.hp < 100) ]
which just silently stopped evaluating when cond
became true. Without Lua errors enabled, it just fails silently, with them
1x tdBattlePetScript/Core/Condition.lua:35: attempt to compare number with string
[string "@tdBattlePetScript/Core/Condition.lua"]:35: in function <tdBattlePetScript/Core/Condition.lua:35>
Locals:
a = 479
b = "100)"
(*temporary) = "attempt to compare number with string"
indicates the typo, but this is of course really bad to understand for users.
As part of the syntax checker,
- conditions should be checked to begin with in this situation
- when checking conditions, this needs to not be short circuit but independent of actual values.
If this is hard in the syntax checker, the runtime error should somehow be transported with Lua errors disabled as well.
I think this should behave like:
- User attempts to run (or test) a script
- A syntax run is done on the script first (and flags up any errors at that point)
- The script is actually run
I assume what is currently happening is that the script is just checking syntax as it goes (or not checking at all depending on how you look at it)
@bloerwald Can this be closed now?