Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: Augs on September 05, 2012, 05:55:11 am
-
The description says it. Is there any code for readin 1 letter off a whole line of letters.
Example,here is the C# one.
(<string>.Substring(<where to start reading>, <How many letters after that>)
-
Yup:
str = "My Name Is Jim"
print(str:sub(2,8))
print(string.sub(str, 2, 8))
Two ways to do it :)
Remember though, the first character is 1, not 0. (as in many other languages)
And, the second arg is the position where you want to stop.
More info here: http://lua-users.org/wiki/StringLibraryTutorial .
Also, you could just post in the other topic. There is no need to create a new one just for this ;)
-
Yup:
str = "My Name Is Jim"
print(str:sub(2,8))
print(string.sub(str, 2, 8))
Two ways to do it :)
Remember though, the first character is 1, not 0. (as in many other languages)
And, the second arg is the position where you want to stop.
More info here: http://lua-users.org/wiki/StringLibraryTutorial .
Also, you could just post in the other topic. There is no need to create a new one just for this ;)
Thanks a lot. While your I'm at it. Do arrays exist in LUA?
-
You got tables.
Tables are like the most incredible thing ever :D
You can use them as arrays, dictionaries, anything. In fact, many stuff in Lua are based around tables.
Just check this out: http://lua-users.org/wiki/TablesTutorial.
-
You got tables.
Tables are like the most incredible thing ever :D
You can use them as arrays, dictionaries, anything. In fact, many stuff in Lua are based around tables.
Just check this out: http://lua-users.org/wiki/TablesTutorial.
Thanks bro.