lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Thanks Wesley, I'm going to use yours after all. Despite being a "black box", it does work.


>Wesley Smith:
>I think this function could be a lot simpler.  string.gmatch is more
>suited to this type of problem than string.find IMHO:
>local myDateString = "2011-06-21"
>function string:split(delim)
>	local res = {}
>	for v in self:gmatch(string.format("([^%s]+)%s?", delim, delim)) do
>		res[#res+1] = v
>	end
>	return res
>local myDateTbl = myDateString.split(myDateString,"-")