Typos in variable names - I have lost count of them. I resorted to strictly copy-pasting them. It slows down the writing process, but searching for such errors is really too much for my nerves. It is a bad design flaw of Lua to silently assume nil for any undefined variable. I have not found a general remedy.
An advanced version of this disaster was this:
- Code: Select all
if state == CLEARED then
This condition never was fulfilled a of course, I searched for reasons everywhere. But the thing is this:
Message - corresponding state:
SIGNAL_BLOCKED - BLOCKED
SIGNAL_WARNING - WARNING
SIGNAL_CLEARED - CLEAR
I tried to stay close to the Kuju code to help people read it. Thus I inherited this curse of an inconsistent definition: cleared vs. clear.
Of course, this again is because I did not copy this occurrence of the constant from Kuju code but edited it consistent with the other cases (being BLOCKED and WARNING), thinking I cannot mistype 5 letters of a single-syllable word.
HTML & CSS can be cited in defence of Lua. They bug me as well. center and color are unavoidable language barriers. But lots of inconsistencies between properties can drive you crazy: vertical-align but text-align, not horizontal-align; HTML equivalents are valign and align. In a way, the RW API looks sane compared to that.
Hacking Lua files in the Assets folder. In particular for small things, I often copy .bin files and .lua files from existing assets and modify them a bit. Recently, I did it again, the script was under 20 lines and just a copy and paste job. Logmate insisted that the signal would not have a script associated with it, which could not be found true even on repeated examination.
The problem was an extra "end" that I inserted in error. Had I exported this object from the blueprint editor, I would have gotten an error message. But since I directly loaded the faulty Lua code into the game, I got no warning at all, the script was decided to be missing.
Not remembering how to test my stuff is also something that curses me. E.g., a signal that only clears as you approach it, or only after you stopped there. I can stare at it in anger, cursing my code, at times.
I resorted to test signals using AI only so I cannot do anything wrong while testing. Does not help an engine developer, of course.
One thing that also helped was adding location markers on the track in approach to signals that tell me what to expect here. Turning F6 on does clutter the display though. But I could recommend that as a way to post notes to yourself for route builders, maybe.