Lua - Split a string and store in an array Code Example

The code for Split a string and store in an array

objProp = { }
touchedSpriteName = "touchedSpriteName = Sprite,10,rose"
index = 1

for value in string.gmatch(touchedSpriteName, "%w+") do 
    objProp[index] = value
    index = index + 1
end

print(objProp[2])
Code by IncludeHelp, on January 2, 2023 20:38
Reference: stackoverflow

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.