diff options
| author | dvs1 | 2024-10-28 23:30:04 +1000 |
|---|---|---|
| committer | dvs1 | 2024-10-28 23:30:04 +1000 |
| commit | b1d60bb06a493b1bd02ea4f02ec7b3656063dba3 (patch) | |
| tree | 6e91329cc7e7db31c31b0fa6dfc06ef907bff428 | |
| parent | Minor tweaks. (diff) | |
| download | JackOnAllDevices-b1d60bb06a493b1bd02ea4f02ec7b3656063dba3.zip JackOnAllDevices-b1d60bb06a493b1bd02ea4f02ec7b3656063dba3.tar.gz JackOnAllDevices-b1d60bb06a493b1bd02ea4f02ec7b3656063dba3.tar.bz2 JackOnAllDevices-b1d60bb06a493b1bd02ea4f02ec7b3656063dba3.tar.xz | |
Various minor tweaks and cleanups.
| -rw-r--r-- | .test_.conf.lua | 4 | ||||
| -rwxr-xr-x | PolygLua.lua | 10 | ||||
| -rwxr-xr-x | test_.lua | 7 |
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. |
| 2 | if type(jit) == 'table' then | 2 | if 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) |
| 4 | else | 4 | else |
| 5 | io.write(arg[0] .. ' is being run by Lua version ' .. _VERSION .. '\n') | 5 | print(arg[0] .. ' is being run by Lua version ' .. _VERSION) |
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | return { | 8 | return { |
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) | |||
| 158 | end | 158 | end |
| 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 |
| 163 | end | 163 | end |
| 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 |
| @@ -1,5 +1,11 @@ | |||
| 1 | #!/usr/bin/env luajit | 1 | #!/usr/bin/env luajit |
| 2 | 2 | ||
| 3 | if type(jit) == 'table' then | ||
| 4 | print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION) | ||
| 5 | else | ||
| 6 | print(arg[0] .. ' is being run by Lua version ' .. _VERSION) | ||
| 7 | end | ||
| 8 | |||
| 3 | 9 | ||
| 4 | local _ = require 'PolygLua' | 10 | local _ = 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 | |||
