diff options
author | Hans Hagen <pragma@wxs.nl> | 2009-12-29 22:32:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2009-12-29 22:32:00 +0100 |
commit | 5eb872dbc6bbc35e222d5b23fc783fb0e75d4a99 (patch) | |
tree | 91164a948df7bcf12b5423db3ef1b310ca2b5017 /tex/context/base/luat-exe.lua | |
parent | 326b0613f1ed21f5711a8d94403512171c058e48 (diff) | |
download | context-5eb872dbc6bbc35e222d5b23fc783fb0e75d4a99.tar.gz |
beta 2009.12.29 22:32
Diffstat (limited to 'tex/context/base/luat-exe.lua')
-rw-r--r-- | tex/context/base/luat-exe.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tex/context/base/luat-exe.lua b/tex/context/base/luat-exe.lua index 721e90c73..10cb6678b 100644 --- a/tex/context/base/luat-exe.lua +++ b/tex/context/base/luat-exe.lua @@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['luat-exe'] = { license = "see context related readme files" } +local match, find = string.match, string.find +local concat = table.concat + if not executer then executer = { } end executer.permitted = { } @@ -24,18 +27,18 @@ function executer.finalize() -- todo: os.exec, todo: report ipv print local t, name, arguments = {...}, "", "" if #t == 1 then if type(t[1]) == 'table' then - name, arguments = t[1], table.concat(t," ",2,#t) + name, arguments = t[1], concat(t," ",2,#t) else - name, arguments = t[1]:match("^(.-)%s+(.+)$") + name, arguments = match(t[1],"^(.-)%s+(.+)$") if not (name and arguments) then name, arguments = t[1], "" end end else - name, arguments = t[1], table.concat(t," ",2,#t) + name, arguments = t[1], concat(t," ",2,#t) end for _,v in pairs(executer.permitted) do - if name:find(v) then + if find(name,v) then execute(name .. " " .. arguments) -- print("executed: " .. name .. " " .. arguments) else |