Mercurial Hosting > luan
comparison src/luan/cmd_line.luan @ 775:1a68fc55a80c
simplify dir structure
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 26 Aug 2016 14:36:40 -0600 |
parents | core/src/luan/cmd_line.luan@3e30cf310e56 |
children | d6d0bd05ad8c |
comparison
equal
deleted
inserted
replaced
774:3e30cf310e56 | 775:1a68fc55a80c |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local ipairs = Luan.ipairs or error() | |
4 local load_file = Luan.load_file or error() | |
5 local try = Luan.try or error() | |
6 local Table = require "luan:Table.luan" | |
7 local Io = require "luan:Io.luan" | |
8 local print = Io.print or error() | |
9 | |
10 | |
11 local args = {...} | |
12 if #args == 0 then | |
13 print("Luan "..Luan.VERSION) | |
14 Io.debug("> ") | |
15 else | |
16 local file = args[1] | |
17 Luan.arg = {} | |
18 for j,v in ipairs(args) do | |
19 Luan.arg[j-1] = v | |
20 end | |
21 try { | |
22 function() | |
23 local main_file = load_file(file) | |
24 print( main_file( Table.unpack(Luan.arg) ) ) | |
25 end; | |
26 catch = function(e) | |
27 -- java(); e.java.printStackTrace(); | |
28 Io.print_to(Io.stderr, e ) | |
29 end; | |
30 } | |
31 end |