lua-users home
lua-l archive

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


> t = Set{'cat', 'dog'}
> 
> seems short enough and very readable

Or simply
	t = Set'cat, dog'
where
	function Set(s)
		local t={}
		for k in s:gmatch("%w+") do
			t[k]=true
		end
		return t
	end

Adapt the pattern "%w+" as needed.