We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm working on a simple demo and when I run the code, it returned me this confusing output:
Here's the code:
require 'io' require 'string' local FOREGROUND <comptime> = 38 local BACKGROUND <comptime> = 48 local function color_range(first: integer, last, anyground: integer) local resetdefault: string = "\x1b[0m" local resetwithspace: string = "\x1b[0m " local resetoutput = resetwithspace for color = first, last do if color % 16 == 0 then io.printf("\n") end if color == last then resetoutput = resetdefault end io.printf(string.format("\x1b[%d;5;%dm%3d%s", anyground, color, color, resetoutput)) end end io.printf("\x1b[1;39m0 to 255 Colors (FOREGROUND)\x1b[22;0m\n") color_range(0, 255, FOREGROUND) io.printf("\n\n") io.printf("\x1b[1;39m0 to 255 Colors (BACKGROUND)\x1b[22;0m\n") color_range(0, 255, BACKGROUND) io.printf("\n\n")
In case you are wondering what's the catch, it's the darn last; I forgot to declare it as integer and the compiler tried to interpret it as any.
last
integer
any
It took me some time disabling my io.printf()s to isolate the behavior.
io.printf()
When a similar issue pops up, what is your suggestion to detect it as soon as possible?
Am I supposed to use a flag or some kind of internal trick to isolate the problematic code?
Can we do something about it @edubart ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm working on a simple demo and when I run the code, it returned me this confusing output:
Here's the code:
In case you are wondering what's the catch, it's the darn
last
; I forgot to declare it asinteger
and the compiler tried to interpret it asany
.It took me some time disabling my
io.printf()
s to isolate the behavior.When a similar issue pops up, what is your suggestion to detect it as soon as possible?
Am I supposed to use a flag or some kind of internal trick to isolate the problematic code?
Can we do something about it @edubart ?
The text was updated successfully, but these errors were encountered: