ADD gmatch to table function
This commit is contained in:
parent
c27dfa0c0a
commit
62008e7eb7
10
src/pure.lua
10
src/pure.lua
|
@ -2,7 +2,9 @@ local M = {}
|
|||
|
||||
local err = require 'err'
|
||||
|
||||
local __string_gmatch = string.gmatch
|
||||
local __math_floor = math.floor
|
||||
local __table_insert = table.insert
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- zippy functions
|
||||
|
@ -175,6 +177,14 @@ M.table_array = function(tbl)
|
|||
return r
|
||||
end
|
||||
|
||||
M.gmatch_table = function(pat, s)
|
||||
local r = {}
|
||||
for m in __string_gmatch(s, pat) do
|
||||
__table_insert(r, m)
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- functional functions
|
||||
|
||||
|
|
Loading…
Reference in New Issue