prpw/prpw

25 lines
478 B
Lua
Executable File

#!/usr/bin/env lua
basepath = (debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])") or "./"):sub(1,-2)
local function main(arg)
package.path = basepath .. "/lib/?.lua;" .. basepath .. "/lib/?/main.lua;" .. package.path
require("prpw")
env.run({"autorun"})
if #arg > 0 then
env.run({"open",arg[1]})
table.remove(arg,1)
env.run(arg)
if env.changed == true then
env.run({"save"})
end
env.run({"exit"})
end
while true do
env.loop()
end
end
main(arg)