diff --git a/src/pure.lua b/src/pure.lua index db4b93c..4efabe5 100644 --- a/src/pure.lua +++ b/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