Mercurial Hosting > luan
diff core/src/luan/modules/Io.luan @ 298:2ce23c7e2342
remove init.luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@299 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 16 Dec 2014 03:51:56 +0000 |
parents | 899253043270 |
children | 9fb523472035 |
line wrap: on
line diff
--- a/core/src/luan/modules/Io.luan Tue Dec 16 03:26:43 2014 +0000 +++ b/core/src/luan/modules/Io.luan Tue Dec 16 03:51:56 2014 +0000 @@ -8,3 +8,27 @@ socket_server = IoLuan.socket_server stdout = IoLuan.textWriter(System.out) stderr = IoLuan.textWriter(System.err) + + +import "luan:Package" +import "luan:Basic" +import "luan:Table" + +function print_to(out,...) + local list = {} + for _,v in Basic.values(...) do + list[#list+1] = to_string(v) + list[#list+1] = '\t' + end + if #list == 0 then + out.write( '\n' ) + else + list[#list] = '\n' + out.write( Table.unpack(list) ) + end +end + +function Basic.print(...) + print_to(stdout,...) +end +Package.global(Basic,"print")