Error
toybox/LGML.lua:125: Syntax error: hunt_TMP:201: main function has more than 200 local variables
Traceback
[C]: in function 'load'
toybox/LGML.lua:125: in function 'getSettingsToSave'
toybox/LGML.lua:165: in function 'saveData'
hunt/GameScreen.lua:1346: in function 'loadOverworld'
hunt/GameScreen.lua:1201: in function 'exitPlace'
hunt/Player.lua:393: in function 'action'
toybox/libs/chrono.lua:38: in function 'update'
toybox/entities/Room.lua:50: in function '__step'
toybox/entities/Game.lua:59: in function '__step'
toybox/LGML.lua:225: in function 'update'
[C]: in function 'xpcall'
Any fix for this? (This is the way I make save files.)
The risk I took was calculated,
but man, am I bad at math.
Yep, lua has a hard-coded limit of 200 local variables within a given scope, or at least within a function. If you wrap some of those variables into a table, you can fit in more, because a table can hold many values, while only "consuming" one local.
Usually I think that reaching this limit is a code smell.
I use a lib called saveTable that saves the game data (nothing bulky, just states and triggers) in a lua file. And wince it was/is a "small" game and bitser seemed not to work on empty files or something, I used that and it's worked up to this point .
I guess maybe I'll try to really get bitser to work.
The risk I took was calculated,
but man, am I bad at math.