Mercurial Hosting > luan
comparison src/luan/cmd_line.luan @ 1277:5ba660381bd5
fix Io.print()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 11 Dec 2018 03:38:43 -0700 |
parents | d6d0bd05ad8c |
children | 0cceff521abb |
comparison
equal
deleted
inserted
replaced
1276:623dfe0e2e73 | 1277:5ba660381bd5 |
---|---|
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.luan" | 6 local Table = require "luan:Table.luan" |
7 local pack = Table.pack or error() | |
8 local unpack = Table.unpack or error() | |
7 local Io = require "luan:Io.luan" | 9 local Io = require "luan:Io.luan" |
8 local print = Io.print or error() | 10 local print = Io.print or error() |
9 | 11 |
10 | 12 |
11 local args = {...} | 13 local args = {...} |
19 Luan.arg[j-1] = v | 21 Luan.arg[j-1] = v |
20 end | 22 end |
21 try { | 23 try { |
22 function() | 24 function() |
23 local main_file = load_file(file) | 25 local main_file = load_file(file) |
24 print( main_file( Table.unpack(Luan.arg) ) ) | 26 local rtn = pack( main_file( unpack(Luan.arg) ) ) |
27 if rtn.n > 0 then | |
28 print( unpack(rtn) ) | |
29 end | |
25 end | 30 end |
26 catch = function(e) | 31 catch = function(e) |
27 -- java(); e.java.printStackTrace(); | 32 -- java(); e.java.printStackTrace(); |
28 Io.print_to(Io.stderr, e ) | 33 Io.print_to(Io.stderr, e ) |
29 end | 34 end |