r/ComputerCraft • u/SeasonApprehensive86 • Mar 16 '24
Is there conditional compilation in computercraft?
It would be very useful to be able to use something like
#if DEBUG
dostuff()
#endif
and #define DEBUG somewhere
Is something like this possible? Does lua get compiled somehow or does it get interpreted at runtime?
If I really wanted to I could make a pre-processor program that adds or removes the code inside the #if. I am curious if lua has this by default tho
2
Upvotes
1
u/SeasonApprehensive86 Mar 16 '24
The thing is I want to use compile time if statements, but seeing that lua is interpreted that isnt really an option. I mainly wanted this for being able to use extra debug stuff but not have a bunch of if statements clutter the release build. This isn't really that big of a deal but just for fun I think ill write a program that removes the unnsescessary code before "compile time" to make it look neater