Skip to content

Commit

Permalink
Tweak anonymous-script.
Browse files Browse the repository at this point in the history
  • Loading branch information
expwnent committed Jul 3, 2014
1 parent 7f65cb4 commit 7b05762
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/modtools/anonymous-script.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
--anonymous-script.lua
--scripts/modtools/anonymous-script.lua
--author expwnent
--a tool for invoking simple lua scripts without putting them in a file first
--anonymous-script "print(args[1])" arg1 arg2 # prints "arg1"
--anonymous-script "print(args[1])" arg1 arg2
--# prints "arg1"

local args = {...}

--automatically collect arguments to make the anonymous script more succinct
local f,err = load('local args = {...}; ' .. args[1], '=(anonymous lua script)') --,'=(lua command)', 't')
if err then
error(err)
Expand Down

0 comments on commit 7b05762

Please sign in to comment.