Lua splits a string and returns it as an array

 Lua splits a string and returns it as an array

function strSplit(str, x)
	local retList = {}
	string.gsub(str, '[^'..x..']+', function(w)
		table.insert(retList, w)
	end)
	return retList
end

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example