summaryrefslogtreecommitdiff
path: root/lualibs-os.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <megas.kapaneus@gmail.com>2013-04-07 19:12:11 +0200
committerPhilipp Gesang <megas.kapaneus@gmail.com>2013-04-07 19:12:11 +0200
commitcca1eef95a689eb483f566b34e2496f2b690ba95 (patch)
treebdad8281d4f6d4ad812b59d1be937053afff1b7d /lualibs-os.lua
parentbe46e9f6cb71c1201e3e8ad2211e0289eb708821 (diff)
downloadlualibs-cca1eef95a689eb483f566b34e2496f2b690ba95.tar.gz
update l-os
Diffstat (limited to 'lualibs-os.lua')
-rw-r--r--lualibs-os.lua26
1 files changed, 17 insertions, 9 deletions
diff --git a/lualibs-os.lua b/lualibs-os.lua
index 799f449..42f3e48 100644
--- a/lualibs-os.lua
+++ b/lualibs-os.lua
@@ -157,7 +157,7 @@ function os.launch(str)
os.execute(format(launchers[os.name] or launchers.unix,str))
end
-if not os.times then
+if not os.times then -- ?
-- utime = user time
-- stime = system time
-- cutime = children user time
@@ -193,14 +193,10 @@ os.resolvers = os.resolvers or { } -- will become private
local resolvers = os.resolvers
-local osmt = getmetatable(os) or { __index = function(t,k) t[k] = "unset" return "unset" end } -- maybe nil
-local osix = osmt.__index
-
-osmt.__index = function(t,k)
- return (resolvers[k] or osix)(t,k)
-end
-
-setmetatable(os,osmt)
+setmetatable(os, { __index = function(t,k)
+ local r = resolvers[k]
+ return r and r(t,k) or nil -- no memoize
+end })
-- we can use HOSTTYPE on some platforms
@@ -448,6 +444,18 @@ end
os.which = which
os.where = which
+function os.today()
+ return date("!*t") -- table with values
+end
+
+function os.now()
+ return date("!%Y-%m-%d %H:%M:%S") -- 2011-12-04 14:59:12
+end
+
+if not os.sleep and socket then
+ os.sleep = socket.sleep
+end
+
-- print(os.which("inkscape.exe"))
-- print(os.which("inkscape"))
-- print(os.which("gs.exe"))