cortav  Artifact [b98a323553]

Artifact b98a323553170957bbaf6fb49ca5e94385d15f45bfdece7f943e114e7e7b5a5a:


-- luac is broken in some distributions, and cannot take more than one
-- argument without crashing on a double free or similar. this
-- completely breaks the cortav build process, so we supply our own
-- ultra-simplistic and painfully primitive luac replacement.
-- this does not generate very good object code.
-- pass luac-broken=1 when building to use
local pgm = ""
local strip = os.getenv("strip")=="1"
if #arg > 1 then
	local chunks = {'local load=load;'}
	for i, f in ipairs(arg) do
		local nc = assert(loadfile(f))
		nc = string.format("load%q(...)", string.dump(nc))
		table.insert(chunks, nc)
	end
	pgm = string.dump(assert(load(table.concat(chunks))))
else
	pgm = string.dump(assert(loadfile(arg[1])))
end

io.stdout:write(pgm)