Files
OpenRA/interpreters/lua.lua
crazybutcher c51fc58014 interpreter stored in settings.ini
interpreter can define which apis to load
added estrelashell interpreter which runs file in shell (has overloaded print/dofile/loadfile with relative file search)
2010-12-19 14:02:27 +00:00

24 lines
829 B
Lua

return {
name = "Lua",
description = "Commandline Lua interpreter",
api = {"wx","baselib"},
fcmdline = function(filepath)
local mainpath = ide.editorFilename:gsub("[^/\\]+$","")
local code = ([[
--require 'lfs'
print("OK");
xpcall(function() dofile '%s' end,
function(err) print(debug.traceback(err)) end)
]]):format(filepath:gsub("\\","/"))
return '"'..mainpath..'/lualibs/lua.exe" -e "'..code..'"'
end,
fprojdir = function(fname)
return ide.editorFilename..'/lualibs/' --fname:GetPath(wx.wxPATH_GET_VOLUME)
end,
capture = true,
fworkdir = function (filepath)
return ide.config.path.projectdir and ide.config.path.projectdir:len()>0 and
ide.config.path.projectdir
end,
--return filepath and filepath:gsub("[\\/]+$","") end,
}