Comment
As mentioned in the postfix section, traditional Lua comments prevent the implementation of the decrementation operator (--
). To disable the traditional single-line Lua comment, one can use --!comment
. Once the compiler sees that this macro is specified, single-line comments will transition over to the #
sign and the --
operator will replace ---
for decrementation.
Below is a code segment that would yield an error at compilation after applying the --!comment
macro.
The following code segment demonstrates the correct usage of the --!comment
macro and the syntax change it produces.
An alternative to this approach of managing the conflicting comment and decrement operator issue would be to use reassignments (var = var - 1
) or compound assignments (var -= 1
).
Last updated