diff options
author | Marius <mariausol@gmail.com> | 2012-08-05 13:40:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-08-05 13:40:13 +0300 |
commit | ccc1d99185ace53707748383dcae8d1fa1ad9dcb (patch) | |
tree | 8a53c44c28446dc7c06794bada339d2586b06d55 /scripts | |
parent | fb43532b6f9ce833b23619edd9bc81a7a3f16212 (diff) | |
download | context-ccc1d99185ace53707748383dcae8d1fa1ad9dcb.tar.gz |
beta 2012.08.05 12:20
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 6 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 6 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index b4df0521b..413fc9f32 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -2159,7 +2159,7 @@ if not modules then modules = { } end modules ['l-number'] = { -- this module will be replaced when we have the bit library -local tostring = tostring +local tostring, tonumber = tostring, tonumber local format, floor, match, rep = string.format, math.floor, string.match, string.rep local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match @@ -2260,6 +2260,10 @@ function number.tobitstring(n,m) end +function number.valid(str,default) + return tonumber(str) or default or nil +end + end -- of closure diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index b4df0521b..413fc9f32 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -2159,7 +2159,7 @@ if not modules then modules = { } end modules ['l-number'] = { -- this module will be replaced when we have the bit library -local tostring = tostring +local tostring, tonumber = tostring, tonumber local format, floor, match, rep = string.format, math.floor, string.match, string.rep local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match @@ -2260,6 +2260,10 @@ function number.tobitstring(n,m) end +function number.valid(str,default) + return tonumber(str) or default or nil +end + end -- of closure diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index b4df0521b..413fc9f32 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -2159,7 +2159,7 @@ if not modules then modules = { } end modules ['l-number'] = { -- this module will be replaced when we have the bit library -local tostring = tostring +local tostring, tonumber = tostring, tonumber local format, floor, match, rep = string.format, math.floor, string.match, string.rep local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match @@ -2260,6 +2260,10 @@ function number.tobitstring(n,m) end +function number.valid(str,default) + return tonumber(str) or default or nil +end + end -- of closure |