I was making a script encoder, when I ran into a major problem. Apparently, string processing commands like string.sub do not support special characters like ☺ and 㐪 and and ␇␈. They only work on common characters, like the ones I can directly type on my keyboard (ie: '!','2','J','j','{',':',etc.). I am using the default local in gameguardian, but I do not think that affects it.
For example, here is outputted when I directly use this special character, without doing any string manipulation on it:
print("☺")
Script ended:
☺
But when I do this exact thing, but with string manipulation commands, this is the output:
print(string.sub("☺",1,1))
Script ended:
�
Let's try with a non-special character:
print("a")
Script ended:
a
print(string.sub("a",1,1))
Script ended:
a
This does not apply to all commands. Let's use a command that is not from the lua string libary:
print("☺".."")
Script ended:
☺
Now, why is this a problem? I need to read and encrypt characters one by one. The only way to get a character one by one is using string.sub (a member of the lua string library), like the code above, or at least this is claimed by the official lua documentary:
I have tried this code, but lua does not let me iterate through string:
for i in"☺"do
print(i)end
How can you help?
If you have any ideas, please tell me a way to input this:
characters ="☺a"
print(string.sub(characters,1,1))-- replace this with your code to print "☺"! You may not type "☺" anywhere in the code besides the first line (characters = "☺a") as this defeats the purpose.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Question
HorridModz
Help me!
I was making a script encoder, when I ran into a major problem. Apparently, string processing commands like string.sub do not support special characters like ☺ and 㐪 and and ␇␈. They only work on common characters, like the ones I can directly type on my keyboard (ie: '!','2','J','j','{',':',etc.). I am using the default local in gameguardian, but I do not think that affects it.
For example, here is outputted when I directly use this special character, without doing any string manipulation on it:
Script ended:
☺
But when I do this exact thing, but with string manipulation commands, this is the output:
Script ended:
�
Let's try with a non-special character:
Script ended:
a
Script ended:
a
This does not apply to all commands. Let's use a command that is not from the lua string libary:
Script ended:
☺
Now, why is this a problem? I need to read and encrypt characters one by one. The only way to get a character one by one is using string.sub (a member of the lua string library), like the code above, or at least this is claimed by the official lua documentary:
https://www.lua.org/pil/20.html
I have tried this code, but lua does not let me iterate through string:
How can you help?
If you have any ideas, please tell me a way to input this:
and output this:
Script ended:
☺
Thanks so much for reading!
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.