WIP: SOC/Lua freeslot parser fixes
This branch adds fixes related to parsing freeslots from SOC and Lua. Most notably, you can no longer create two or more freeslots with the same name; if you attempt to do this (by accident usually), a warning about it will be printed in the console. (Note that in Lua, this does not break hooks unlike typical Lua errors, it just moves on to the next freeslot as expected.)
This is currently WIP because I think there were changes I intended to make before making this MR, though I forget what they were right now.
-
I thought freeslotting the same name would just not do anything
-
Maybe out of the scope of this MR, just thinking out loud - but Lua should probably push nil if a freeslot fails for whatever reason. Or maybe push the existing value if it already exists. As it is now, if you had
local myobject, mystate, mysfx = freeslot("MT_MYOBJECT", "S_MYSTATE", "sfx_mysfx")
and it failed to freeslot the state,mystate
would store the value pushed forsfx_mysfx
, no? -
Master
Kays: I had thought about that, yeah. It would just need to explcitly push nil and count them in the results count (which is what pushes them to the Lua stack and gives the results to the variables in the script, or something like that).
Zolton Auburn: That's mostly true, except when it comes to sprites. IIRC people in the past have encountered weird errors when they accidentally freeslot a sprite in both Lua and SOC. Because of the
!sprnames[j][4]
thing in particular, the original sprite slot becomes inaccessible. Any time you'd refer to the sprite name always refers to the newest sprite slot instead!Apart from that though, we've been meaning to make the game report when you duplicate freeslot resources for ages now. I've just been distracted by many other things over the years.
-
added 783 commits
-
72dc2462...3e02f5d0 - 782 commits from branch
next
- 6191041a - Merge branch 'next' into parser-fixes
Toggle commit list -
72dc2462...3e02f5d0 - 782 commits from branch
-
Master
Since everyone including me has forgotten about this MR, and !1222 (merged) has already been accepted since a month ago, and I don't seem to have much motivation to work on this or anything SRB2 lately, perhaps its best if someone else can recreate these fixes with the new files and figure out what I forgot to do (I know I forgot to do something but can't recall what offhand).
-
closed
Toggle commit list