diff src/luan/lib/init.luan @ 119:f1bf2890d80f

support String methods git-svn-id: https://luan-java.googlecode.com/svn/trunk@120 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 01 Jun 2014 09:38:40 +0000
parents src/luan/init.luan@735708619119
children 8d7730a5e3b4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/luan/lib/init.luan	Sun Jun 01 09:38:40 2014 +0000
@@ -0,0 +1,37 @@
+--Io.stdout.write "this is init.luan\n"
+
+local function print(...)
+	local list = {}
+	for v in Basic.values(...) do
+		list[#list+1] = to_string(v)
+		list[#list+1] = '\t'
+	end
+	if #list == 0 then
+		Io.stdout.write( '\n' )
+	else
+		list[#list] = '\n'
+		Io.stdout.write( Table.unpack(list) )
+	end
+end
+
+_G.print = print
+
+
+local Debug = {}
+Package.loaded.Debug = Debug
+_G.Debug = Debug
+
+function Debug.debug(prompt)
+	prompt = prompt or "luan_debug> "
+	local function console()
+		return Io.read_console_line(prompt)
+	end
+	for line in console do
+		local fn = load(line,"stdin",true)
+		local result = Table.pack( fn() )
+		if result.n > 0 then
+			print( Table.unpack(result,1,result.n) )
+		end
+	end
+end
+