summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--lualibs-boolean.lua4
-rw-r--r--lualibs-io.lua2
-rw-r--r--lualibs-os.lua24
4 files changed, 22 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 556e56f..f04503a 100644
--- a/Makefile
+++ b/Makefile
@@ -112,5 +112,6 @@ clean:
mrproper: clean
@$(RM) -- $(GENERATED) $(ZIPS)
+ @$(RM) -r $(DISTDIR)
merge: $(MERGED)
diff --git a/lualibs-boolean.lua b/lualibs-boolean.lua
index f087f1a..8d11080 100644
--- a/lualibs-boolean.lua
+++ b/lualibs-boolean.lua
@@ -59,9 +59,9 @@ end
function string.is_boolean(str,default)
if type(str) == "string" then
- if str == "true" or str == "yes" or str == "on" or str == "t" then
+ if str == "true" or str == "yes" or str == "on" or str == "t" or str == "1" then
return true
- elseif str == "false" or str == "no" or str == "off" or str == "f" then
+ elseif str == "false" or str == "no" or str == "off" or str == "f" or str == "0" then
return false
end
end
diff --git a/lualibs-io.lua b/lualibs-io.lua
index e3a443b..52f166a 100644
--- a/lualibs-io.lua
+++ b/lualibs-io.lua
@@ -60,7 +60,7 @@ io.readall = readall
function io.loaddata(filename,textmode) -- return nil if empty
local f = io.open(filename,(textmode and 'r') or 'rb')
if f then
--- local data = f:read('*all')
+ -- local data = f:read('*all')
local data = readall(f)
f:close()
if #data > 0 then
diff --git a/lualibs-os.lua b/lualibs-os.lua
index a4c0ac8..3838b55 100644
--- a/lualibs-os.lua
+++ b/lualibs-os.lua
@@ -382,31 +382,43 @@ end
local timeformat = format("%%s%s",os.timezone(true))
local dateformat = "!%Y-%m-%d %H:%M:%S"
+local lasttime = nil
+local lastdate = nil
function os.fulltime(t,default)
- t = tonumber(t) or 0
+ t = t and tonumber(t) or 0
if t > 0 then
-- valid time
elseif default then
return default
else
- t = nil
+ t = time()
end
- return format(timeformat,date(dateformat,t))
+ if t ~= lasttime then
+ lasttime = t
+ lastdate = format(timeformat,date(dateformat))
+ end
+ return lastdate
end
local dateformat = "%Y-%m-%d %H:%M:%S"
+local lasttime = nil
+local lastdate = nil
function os.localtime(t,default)
- t = tonumber(t) or 0
+ t = t and tonumber(t) or 0
if t > 0 then
-- valid time
elseif default then
return default
else
- t = nil
+ t = time()
+ end
+ if t ~= lasttime then
+ lasttime = t
+ lastdate = date(dateformat,t)
end
- return date(dateformat,t)
+ return lastdate
end
function os.converttime(t,default)