Steamopollys / Steamodded

A Balatro ModLoader
GNU General Public License v3.0
224 stars 50 forks source link

Better error chunk names #112

Closed WilsontheWolf closed 5 months ago

WilsontheWolf commented 5 months ago

This improves the error message --- STEAMODDED HEADER...:25: Funny Crash go BRRRRRRRRRRR > [SMODS Crashing "Crashing.lua"]:25: Funny Crash go BRRRRRRRRRRR

For the name, the vars are <const SMODS> <Mod ID> "<Mod filename>".

A side effect of this is the mod in the stack trace is a bit different.

(4) Lua method 'key_press_update' at line 25 of mod Crashing (Crashing) 
Local variables:
 self = table: 0x047af920  {dragging:table: 0x047afaa0, pressed_keys:table: 0x047affe0, held_keys:table: 0x047b0540 (more...)}
 key = string: "["
 dt = number: 0.0210579

to

(4) Lua method 'key_press_update' at file 'Crashing.lua:25' (from mod with id Crashing)
Local variables:
 self = table: 0x042e6258  {lock_input:false, clicked:table: 0x044c0fb0, focused:table: 0x04412c50 (more...)}
 key = string: "["
 dt = number: 0.0211131

I could probably hack together something that lets me get the mod name again, but it, this keeps the code simple, and i don't think it's necessary, especially with the addition of a filename.