view core/src/luan/modules/Io.luan @ 333:2b72947d421a

README.md edited online with Bitbucket
author Hugo Teixeira <hugo.tech@gmail.com>
date Wed, 25 Mar 2015 04:27:56 +0000
parents 7f7708e8fdd4
children 8668f3799ad9
line wrap: on
line source

java()
local IoLuan = require "java:luan.modules.IoLuan"
local System = require "java:java.lang.System"

read_console_line = IoLuan.read_console_line
schemes = IoLuan.newSchemes()
Uri = IoLuan.Uri
stdin = IoLuan.defaultStdin.table()
socket_server = IoLuan.socket_server
stdout = IoLuan.textWriter(System.out)
stderr = IoLuan.textWriter(System.err)


local Luan = require "luan:Luan"
local to_string = Luan.to_string
local Table = require "luan:Table"

function print_to(out,...)
	local list = {}
	for _,v in Luan.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 print(...)
	print_to(stdout,...)
end