comparison core/src/luan/cmd_line.luan @ 693:ca169567ce07

module URIs must now include ".luan"
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 19 Apr 2016 15:54:11 -0600
parents e25ba7a2e816
children 3e30cf310e56
comparison
equal deleted inserted replaced
692:7bd97d642f37 693:ca169567ce07
1 local Luan = require "luan:Luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local ipairs = Luan.ipairs or error() 3 local ipairs = Luan.ipairs or error()
4 local load_file = Luan.load_file or error() 4 local load_file = Luan.load_file or error()
5 local try = Luan.try or error() 5 local try = Luan.try or error()
6 local Table = require "luan:Table" 6 local Table = require "luan:Table.luan"
7 local Io = require "luan:Io" 7 local Io = require "luan:Io.luan"
8 local print = Io.print or error() 8 local print = Io.print or error()
9 9
10 10
11 local args = {...} 11 local args = {...}
12 if #args == 0 then 12 if #args == 0 then
18 for j,v in ipairs(args) do 18 for j,v in ipairs(args) do
19 Luan.arg[j-1] = v 19 Luan.arg[j-1] = v
20 end 20 end
21 try { 21 try {
22 function() 22 function()
23 local main_file = load_file(file,true) 23 local main_file = load_file(file)
24 print( main_file( Table.unpack(Luan.arg) ) ) 24 print( main_file( Table.unpack(Luan.arg) ) )
25 end; 25 end;
26 catch = function(e) 26 catch = function(e)
27 -- java(); e.java.printStackTrace(); 27 -- java(); e.java.printStackTrace();
28 Io.print_to(Io.stderr, e ) 28 Io.print_to(Io.stderr, e )