I have recently come across a new string format called UTF-8.. I was told that many of the popular games such as: Jailbreak, Phantom Forces and Arsenal use it. I was told this is because it is more accurate than Roblox’s string. and improved performance.
If this is true should I be using string. or UTF-8.?
what are the benefits of using either should I use one or both. Since my game relies on performance, because its doing so many math and graphics which should I use?
UTF-8 is somewhere around 30 years old and 90%+ of the web uses it. Chances are high Roblox uses it anyways, but implementation details like that shouldn’t really affect you.
The string library provides a lot of useful tools, like gmatch for POSIX usage Lua doesn’t support full regular expressions however it does do some great pattern matching (not sure if Luau contradicts what I’m saying here). You can read about that here.
The UTF-8 library provides a better length function too for foreign characters/symbols (cyrillic, Korean, Arabic, etc).
In all you’ll probably use the string library more than the UTF-8 library! To some extent, whatever one you choose doesn’t really matter.
Both. They’re used for completely different purposes and one cannot replace the other. If you look at the docs:
… it’s clear that either one has functionality that the other one doesn’t.
uft-8 is related to unicode. The 5 second version of “what is unicode” is that it’s a system of representing characters that supports a lot more symbols and languages than ASCII, which only supports Arabic numerals (0-9) and latin script (A-Z) (what we’re using to type right now) plus some punctuation and control stuff. You only need to worry about utf-8 if you want to do some pretty specific stuff related to internationalization, like if you for some reason need to know how many characters are in a string containing Arabic script, Chinese, Japanese, emojis, etc…
Unicode is an interesting topic, but also pretty advanced and it’s not really something you need to know to make games, unless you’re making Typing of the Dead or something.