diff options
author | Marius <mariausol@gmail.com> | 2012-06-05 23:00:15 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-06-05 23:00:15 +0300 |
commit | 7eed65970869ede47697d448e88fa4722418b7f3 (patch) | |
tree | 923cbee85f394d0613817412b9188cfb9810d030 /scripts/context/stubs | |
parent | 6bfe227f2a770f059502000d4c7f20d5d8ef4024 (diff) | |
download | context-7eed65970869ede47697d448e88fa4722418b7f3.tar.gz |
beta 2012.06.05 21:45
Diffstat (limited to 'scripts/context/stubs')
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 13 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index cc29845b5..8bd243b54 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -150,6 +150,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted @@ -3266,8 +3271,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index cc29845b5..8bd243b54 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -150,6 +150,11 @@ function string.topattern(str,lowercase,strict) end end + +function string.valid(str,default) + return (type(str) == "string" and str ~= "" and str) or default or nil +end + -- obsolete names: string.quote = string.quoted @@ -3266,8 +3271,12 @@ end local isscheme = schemestr * colon * slash * slash -- this test also assumes authority local function hasscheme(str) - local scheme = lpegmatch(isscheme,str) -- at least one character - return scheme ~= "" and scheme or false + if str then + local scheme = lpegmatch(isscheme,str) -- at least one character + return scheme ~= "" and scheme or false + else + return false + end end |