This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Account1's profile picture

Programing question [lua] [question]

Started by Account1, 20 December 2012 - 05:46 PM
Account1 #1
Posted 20 December 2012 - 06:46 PM
i have a variable that is bob:23(i have a whole file with similar), how do i make the 23 into its own variable?
ChunLing #2
Posted 20 December 2012 - 06:51 PM
Is "bob:23" the value or the identifier?
Lyqyd #3
Posted 20 December 2012 - 06:52 PM

str, val = string.match("bob:23", "([^:])+:(.*)")
str contains bob, val contains 23. See string manipulation.
Edited by