summaryrefslogtreecommitdiff
path: root/qw.lua
blob: 3b27816a26594469ae1f0a4b624b1310839678c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- qw"aaa bbb ccc" --> { "aaa", "bbb", "ccc" }
local function qw(str)
	local out = {}
	for x in str:gmatch"%S+" do
		table.insert(out, x)
	end
	return out
end
-- qw.s"aaa bbb ccc" --> { aaa=true, bbb=true, ccc=true }
local function qws(str)
	local out = {}
	for x in str:gmatch"%S+" do
		out[x] = true
	end
	return out
end
return setmetatable({qw=qw,s=qws},{__call=function(_,...) return qw(...) end})