Closed ten3roberts closed 4 years ago
When you index a string or have a function that returns a character, it is returned as an int
This is perfectly normal
However when concatenating it to a string it is treated as an integer This most commonly happens with File.readn('c')
Example:
local s = "" foreach (c in characters) { s += c } // Prints "979899", the ascii values for the supplied characters print(s + "\n")
The only workaround for this is to use the format("%c", c), but it is unnecesarrily complex for such a simple task
I propose a char(c) function that returns a 1 long string representing the ascii value supplied
This is similar to the chr(c) function in Python
I can implement it and create a PR if it is wanted
try this:
s+= c.tochar()
Awesome. Love the language
When you index a string or have a function that returns a character, it is returned as an int
This is perfectly normal
However when concatenating it to a string it is treated as an integer This most commonly happens with File.readn('c')
Example:
The only workaround for this is to use the format("%c", c), but it is unnecesarrily complex for such a simple task
I propose a char(c) function that returns a 1 long string representing the ascii value supplied
This is similar to the chr(c) function in Python
I can implement it and create a PR if it is wanted