[BUG] Unable to Edit/Delete/Save a variable with lua error
dennisaschmidt opened this issue Β· 5 comments
π΅ Describe the bug:
If your lua code in a variable has an error in it, the delete/save buttons are not available. This makes the variable perpetually in an error state and uneditable, unremovable, and GSE now in constant error.
π΅ To reproduce: (Steps to reproduce the behavior)
- Go to Variables
- Add any variable, and insert lua code and put a simple syntax error in it, save it
For example:
function()
local SpellBookSlot = C_SpellBook.FindSpellBookSlotForSpell(432459)
return SpellBookSlot > 0
end
The example code on this wiki for finding if a spell is known I think is old and produces an error (FindSpellBookSlotForSpell may return nil and can't compare to 0)
π΅ The error:
Paste the error message in this blockquote.
24x [string "return function(spellID)..."]:3: attempt to compare number with nil
[string "return function(spellID)
local SpellBookSlot = C_SpellBook.FindSpellBookSlotForSpell(432459)
return SpellBookSlot > 0
end"]:3: in function `?'
[string "@GSE/API/Storage.lua"]:1138: in function `UpdateVariable'
[string "@GSE/API/Events.lua"]:653: in function `?'
[string "@Decursive/Libs/AceTimer-3.0-17/AceTimer-3.0.lua"]:55: in function <Decursive/Libs/AceTimer-3.0/AceTimer-3.0.lua:50>
π΅ Screenshots:
See screenshot with no save/delete buttons
π΅ Expected behavior:
Regardless of the validity of the lua for a variable code, it shouldn't remove the buttons and shouldn't to make corrective action. Effectively now, you better get your lua code correct the first time, or the bad code is stuck in there forever.
π΅ GSE.lua file:
Don't think this is needed? Problem is with variables and not a specific sequence.
π΅ Desktop (please complete the following information):
- OS: Windows 10 Home
- Game Version 11.0.5
π΅ GSE Version:
- Version: 3.2.17
- Downloaded From: Curse
I will add, the contagion of a bad lua variable will spread to any sequences that utilize that variable and the sequence will be uneditable also.
This isnβt a bug. It prevents you from bricking your GSE install by not letting you save a broken variable.
if you go to the minimap icon you need to remove the Updatw Variable lines from the Out of Combat Queue by clicking on them. Once you do and correct the variable you will be able to save.
This particular example was also updated yesterday but I hadnβt updated the Wiki to reflect it. You can import it from https://wago.io/IHWwUk5_t
Blizzard changed C_SpellBook.FindSpellBookSlotForSpell( to report a nil instead of a 0 when a spell isnβt known.
I have updated the Wiki and also put in a check that the variable compiles before attempting to save it.