view core/src/luan/cmd_line.luan @ 555:e25ba7a2e816

some String documentation and fixes
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 19 Jun 2015 04:29:06 -0600
parents 18504c41b0be
children ca169567ce07
line wrap: on
line source

local Luan = require "luan:Luan"
local error = Luan.error
local ipairs = Luan.ipairs or error()
local load_file = Luan.load_file or error()
local try = Luan.try or error()
local Table = require "luan:Table"
local Io = require "luan:Io"
local print = Io.print or error()


local args = {...}
if #args == 0 then
	print(Luan.VERSION)
	Io.debug("> ")
else
	local file = args[1]
	Luan.arg = {}
	for j,v in ipairs(args) do
		Luan.arg[j-1] = v
	end
	try {
		function()
			local main_file = load_file(file,true)
			print( main_file( Table.unpack(Luan.arg) ) )
		end;
		catch = function(e)
--			java(); e.java.printStackTrace();
			Io.print_to(Io.stderr, e )
		end;
	}
end