diff src/luan/modules/http/tools/Run.luan @ 1716:b82767112d8e

add String.regex
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 24 Jul 2022 23:43:03 -0600
parents d6ec67fa4a61
children
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Run.luan	Sat Jul 23 21:53:04 2022 -0600
+++ b/src/luan/modules/http/tools/Run.luan	Sun Jul 24 23:43:03 2022 -0600
@@ -4,14 +4,16 @@
 local Io = require "luan:Io.luan"
 local print = Io.print or error()
 local String = require "luan:String.luan"
-local gmatch = String.gmatch or error()
+local regex = String.regex or error()
 local Http = require "luan:http/Http.luan"
 
 
 local Run = {}
 
+local line_regex = regex("([^\n]*)\n|([^\n]+)$")
+
 local function lines(s)
-	local matcher = gmatch(s,"([^\n]*)\n|([^\n]+)$")
+	local matcher = line_regex.gmatch(s)
 	return function()
 		local m1, m2 = matcher()
 		return m1 or m2