Jump to content




Programing question [lua] [question]


  • You cannot reply to this topic
2 replies to this topic

#1 Account1

  • New Members
  • 1 posts

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?

#2 ChunLing

  • Members
  • 2,027 posts

Posted 20 December 2012 - 06:51 PM

Is "bob:23" the value or the identifier?

#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 December 2012 - 06:52 PM

str, val = string.match("bob:23", "([^:])+:(.*)")

str contains bob, val contains 23. See string manipulation.

Edited by Lyqyd, 20 December 2012 - 06:54 PM.
added code tags because forum auto-smily is dumb.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users