diff options
Diffstat (limited to '')
-rwxr-xr-x | PolygLua.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/PolygLua.lua b/PolygLua.lua index 727e62c..20925b7 100755 --- a/PolygLua.lua +++ b/PolygLua.lua | |||
@@ -29,13 +29,13 @@ local log = function(v, t, s) | |||
29 | io.flush() | 29 | io.flush() |
30 | end | 30 | end |
31 | 31 | ||
32 | -- This sets the global values, here and in the caller. | 32 | -- This sets the global values, here and in the caller. The "_G." part isn't needed, it's just there to make things more obvious to the reader. |
33 | D = function(s) log(4, 'DEBUG ', s) end | 33 | _G.D = function(s) log(4, 'DEBUG ', s) end |
34 | I = function(s) log(3, 'INFO ', s) end | 34 | _G.I = function(s) log(3, 'INFO ', s) end |
35 | T = function(s) log(2, 'TIMEOUT ', s) end | 35 | _G.T = function(s) log(2, 'TIMEOUT ', s) end |
36 | W = function(s) log(1, 'WARNING ', s) end | 36 | _G.W = function(s) log(1, 'WARNING ', s) end |
37 | E = function(s) log(0, 'ERROR ', s) end | 37 | _G.E = function(s) log(0, 'ERROR ', s) end |
38 | C = function(s) log(-1, 'CRITICAL ', s) end | 38 | _G.C = function(s) log(-1, 'CRITICAL ', s) end |
39 | 39 | ||
40 | 40 | ||
41 | local optionsCommon = | 41 | local optionsCommon = |
@@ -190,7 +190,7 @@ _.readCmd = function(cmd) | |||
190 | end | 190 | end |
191 | 191 | ||
192 | 192 | ||
193 | __ = function(c) | 193 | _G.__ = function(c) |
194 | local exe = {status = 0, lines = {}, logging = false, showing = false, cmd = '', command = c, isScript = false, script = ''} | 194 | local exe = {status = 0, lines = {}, logging = false, showing = false, cmd = '', command = c, isScript = false, script = ''} |
195 | local n = 0 | 195 | local n = 0 |
196 | 196 | ||
@@ -201,7 +201,7 @@ __ = function(c) | |||
201 | exe.cmd = exe.cmd .. l .. ' ; ' | 201 | exe.cmd = exe.cmd .. l .. ' ; ' |
202 | end | 202 | end |
203 | elseif 'string' == type(c) then | 203 | elseif 'string' == type(c) then |
204 | exe.isScript = ('#!' == c:sub(1,2)) and (n == 0) | 204 | exe.isScript = (n == 0) and ('#!' == c:sub(1,2)) |
205 | for l in string.gmatch(c, '\n*([^\n]+)\n*') do | 205 | for l in string.gmatch(c, '\n*([^\n]+)\n*') do |
206 | if '' ~= l then | 206 | if '' ~= l then |
207 | if exe.isScript then | 207 | if exe.isScript then |