diff options
author | ubq323 <ubq323@ubq323.website> | 2025-05-30 16:41:55 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2025-05-30 16:41:55 +0100 |
commit | 3212d37f8e7c2b2aba706ab5e5064fae84526956 (patch) | |
tree | 2c3f7430798a0d51421e77529025dc41d7f93e12 /qw.lua | |
parent | 23062e3fddcbc73ac51faaaaf46627477e413f6e (diff) |
add qw.lua
Diffstat (limited to 'qw.lua')
-rw-r--r-- | qw.lua | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,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}) |