Someone ever needed to split a string?
What do I need to get all the values of a url and assign variables example: http://192.168.4.1/?SSID=MySSID&Passwor ... MyNickName
If someone has an example will be grateful.
My code :
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
delimiter = string.split("Manoel&Pereira&dos&santos ","&")
print(delimiter[1])
print(delimiter[2])
print(delimiter[3])
print(delimiter[4])
return error: init.lua:14: attempt to call field 'split' (a nil value)