FWCentral Posted July 2, 2012 Posted July 2, 2012 Hey im trying to split a string into two parts the string will always have a space like this example: "Data1 Data2" How can i make it like this: local data1,data2 = Data1, Data2 i tried: local data1, data2 = table.concat(thestring, ", ") Found the answer: Use the Lua split function.
arezu Posted July 3, 2012 Posted July 3, 2012 example: local theString = "Data1 Data2" local data = split(theString, " ") --data[1] is now "Data1" and data[2] is "Data2"
MTA Team qaisjp Posted July 3, 2012 MTA Team Posted July 3, 2012 Or: local theString = "Data1 Data2" local data1, data2 = unpack(split(theString," ")) Hope that helps you liam
Castillo Posted July 3, 2012 Posted July 3, 2012 Found the answer: Use the Lua split function. He already solved his problem.
MTA Team qaisjp Posted July 4, 2012 MTA Team Posted July 4, 2012 Found the answer: Use the Lua split function. He already solved his problem. AFTER we told him.
Castillo Posted July 4, 2012 Posted July 4, 2012 Found the answer: Use the Lua split function. He already solved his problem. AFTER we told him. No, actually he already solved it before anyone had posted ( I didn't post because it was already solved ).
Recommended Posts