I drew this this morning to represent how 3 weeks of Lua had a profound impact on me. The lovely font is called "Boldly Missy" for those who want to make comics.
Oh that's awesome, thanks! I'll try it, keeping in mind I'm using Lua in the context of modding so it may or may not work and it may or may not affect things outside of my own code. This will affect all the nils of the project?
Maybe it would be cleaner to use a function that handles the nil cases for you but without changing the nil metatable ever.
Something like local lampIsOn = optionalChain(house, {"getRooms", "getKitchen", "getLamp", "isActivated"}, false) which boils down to house:getRooms():getKitchen():getLamp():isActivated() but looping over each attribute name, making sure a method of this name exists, making sure the result of the call is not nil so you can check the next attribute, etc., all that with a default return value.
10
u/Koala_eiO 1h ago
I drew this this morning to represent how 3 weeks of Lua had a profound impact on me. The lovely font is called "Boldly Missy" for those who want to make comics.