Template:ScriptingExamples/UtilityCode/Lua/split

From GTA Connected
Revision as of 16:20, 14 August 2018 by Mex (talk | contribs) (Created page with "-- https://stackoverflow.com/questions/1426954/split-string-in-lua function split(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gma...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

-- https://stackoverflow.com/questions/1426954/split-string-in-lua function split(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end