I thought "char" is a meaningless name, so the name is "from_integers". But I also didn't completely implement Math.random() which you need. This is fixed in rev 245. You can copy dist/jars/*.jar if you need them.
If you prefer you can rename those methods to to_byte() and from_char(). It would imply a conversion, so doesn't matter what is underneath. The names pack() and unpack() make no sense to me in this case. For strings, I would believe that pack()/unpack() is used for compression/uncompression of the string and that would be completely wrong.
to_byte() is just as bad because this has nothing to do with bytes. Lua is based on C where a char is a byte but Luan is based on Java where a char is not a byte, so the function that "Returns the internal numerical codes of the characters" in Luan does not return bytes.
A char in java has two bytes, so "has nothing to do with bytes" is not true as well. But I accept your complaint and we could have to_chars(), but I am not sure what we could do with that. Can we, for example, do this?
local chars = str.to_chars()
if chars == 'A' then
So now you want to name from_char() what you previously called to_chars() . I don't understand.
No. Please read the root post of this thread. We need a way to build a string with specific character codes. In java we can do this:
String literal = "\u2190\u2195";
How can we do this in Luan?
So my point was that we could have something like this:
local str = String.from_char(2190, 'UTF8') .. String.from_char(2195, 'UTF8')
local str = String.from_char('u2190') .. String.from_char('u2195')
The to_chars() is another story. In java, the char values are mainly used for comparison with literal values, like c == 'A' and this doesn't exist in Luan (as you explained, we should use str.sub(1,1) instead). I have never seen people actually checking the numeric value of a char, so I suggest we keep this method off until someone explains why we need it.