Mercurial Hosting > luan
comparison core/src/luan/modules/Io.luan @ 320:fed1893821bf
remove global namespace
git-svn-id: https://luan-java.googlecode.com/svn/trunk@321 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 06 Feb 2015 21:54:41 +0000 |
parents | f6db49c294a7 |
children | 7f7708e8fdd4 |
comparison
equal
deleted
inserted
replaced
319:f6db49c294a7 | 320:fed1893821bf |
---|---|
1 java() | 1 java |
2 import "java:luan.modules.IoLuan" | 2 import "java:luan.modules.IoLuan" |
3 import "java:java.lang.System" | 3 import "java:java.lang.System" |
4 | 4 |
5 read_console_line = IoLuan.read_console_line | 5 read_console_line = IoLuan.read_console_line |
6 schemes = IoLuan.newSchemes() | 6 schemes = IoLuan.newSchemes() |
9 socket_server = IoLuan.socket_server | 9 socket_server = IoLuan.socket_server |
10 stdout = IoLuan.textWriter(System.out) | 10 stdout = IoLuan.textWriter(System.out) |
11 stderr = IoLuan.textWriter(System.err) | 11 stderr = IoLuan.textWriter(System.err) |
12 | 12 |
13 | 13 |
14 import "luan:Package" | |
15 import "luan:Luan" | 14 import "luan:Luan" |
16 import "luan:Table" | 15 import "luan:Table" |
16 | |
17 local to_string = Luan.to_string | |
17 | 18 |
18 function print_to(out,...) | 19 function print_to(out,...) |
19 local list = {} | 20 local list = {} |
20 for _,v in Luan.values(...) do | 21 for _,v in Luan.values(...) do |
21 list[#list+1] = to_string(v) | 22 list[#list+1] = to_string(v) |
27 list[#list] = '\n' | 28 list[#list] = '\n' |
28 out.write( Table.unpack(list) ) | 29 out.write( Table.unpack(list) ) |
29 end | 30 end |
30 end | 31 end |
31 | 32 |
32 function Luan.print(...) | 33 function print(...) |
33 print_to(stdout,...) | 34 print_to(stdout,...) |
34 end | 35 end |
35 Package.global(Luan,"print") |