aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.test_.conf.lua4
-rwxr-xr-xPolygLua.lua10
-rwxr-xr-xtest_.lua7
3 files changed, 14 insertions, 7 deletions
diff --git a/.test_.conf.lua b/.test_.conf.lua
index e35fc72..1bd73c1 100644
--- a/.test_.conf.lua
+++ b/.test_.conf.lua
@@ -1,8 +1,8 @@
1-- This works coz LuaJIT automatically loads the jit module. 1-- This works coz LuaJIT automatically loads the jit module.
2if type(jit) == 'table' then 2if type(jit) == 'table' then
3 io.write(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '\n') 3 print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION)
4else 4else
5 io.write(arg[0] .. ' is being run by Lua version ' .. _VERSION .. '\n') 5 print(arg[0] .. ' is being run by Lua version ' .. _VERSION)
6end 6end
7 7
8return { 8return {
diff --git a/PolygLua.lua b/PolygLua.lua
index 20925b7..8d63d8a 100755
--- a/PolygLua.lua
+++ b/PolygLua.lua
@@ -106,7 +106,7 @@ _.parse = function(args, options, confFile)
106 if nil ~= confFile then 106 if nil ~= confFile then
107 for i,v in ipairs{'/etc/', '~/.', './.'} do 107 for i,v in ipairs{'/etc/', '~/.', './.'} do
108 local p = v .. confFile .. '.conf.lua' 108 local p = v .. confFile .. '.conf.lua'
109 local h, e = io.open(p, 'r') 109 local h = io.open(p, 'r')
110 if nil ~= h then 110 if nil ~= h then
111 D('Found configuration file '.. p) 111 D('Found configuration file '.. p)
112 h:close() 112 h:close()
@@ -124,9 +124,9 @@ _.parse = function(args, options, confFile)
124 local ds = 0 124 local ds = 0
125 if ('-' == a:sub(1, 1)) and ('-' ~= a:sub(2, 2)) then ds = 1 end 125 if ('-' == a:sub(1, 1)) and ('-' ~= a:sub(2, 2)) then ds = 1 end
126 if '--' == a:sub(1, 2) then ds = 2; a = a:sub(3, -1) end 126 if '--' == a:sub(1, 2) then ds = 2; a = a:sub(3, -1) end
127 local s, e = a:find('=') 127 local s, e = a:find('=', 1, true)
128 local k , v 128 local k , v
129 if nil == s then 129 if not s then
130 e = 0 130 e = 0
131 v = nil 131 v = nil
132 else 132 else
@@ -158,7 +158,7 @@ _.running = function(c)
158end 158end
159 159
160_.exists = function(f) 160_.exists = function(f)
161 local h, e = io.open(f, 'r') 161 local h = io.open(f, 'r')
162 if nil == h then return false else h:close(); return true end 162 if nil == h then return false else h:close(); return true end
163end 163end
164 164
@@ -222,7 +222,7 @@ _G.__ = function(c)
222 end 222 end
223 if exe.isScript then 223 if exe.isScript then
224 local a, e = io.open(exe.scriptFile, 'w') 224 local a, e = io.open(exe.scriptFile, 'w')
225 if nil == a then E('Could not open ' .. exe.scriptFile) else 225 if nil == a then E('Could not open ' .. exe.scriptFile .. ' - ' .. e) else
226 a:write(exe.script) 226 a:write(exe.script)
227 a:close() 227 a:close()
228 end 228 end
diff --git a/test_.lua b/test_.lua
index 1a892a9..872bea7 100755
--- a/test_.lua
+++ b/test_.lua
@@ -1,5 +1,11 @@
1#!/usr/bin/env luajit 1#!/usr/bin/env luajit
2 2
3if type(jit) == 'table' then
4 print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION)
5else
6 print(arg[0] .. ' is being run by Lua version ' .. _VERSION)
7end
8
3 9
4local _ = require 'PolygLua' 10local _ = require 'PolygLua'
5 11
@@ -159,3 +165,4 @@ __'date':log():show():Do()
159-- Should get that "later" thing printed while the sleep is happening. 165-- Should get that "later" thing printed while the sleep is happening.
160__'date; sleep 5; date':log():show():Do() 166__'date; sleep 5; date':log():show():Do()
161 167
168