Mercurial Hosting > luan
comparison src/luan/CmdLine.java @ 21:c93d8c781853
add functions
git-svn-id: https://luan-java.googlecode.com/svn/trunk@22 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 04 Dec 2012 09:16:03 +0000 |
parents | a7c13c6017f7 |
children | 409871b33355 |
comparison
equal
deleted
inserted
replaced
20:d85510d92eee | 21:c93d8c781853 |
---|---|
25 if( i == args.length ) { | 25 if( i == args.length ) { |
26 interactive = true; | 26 interactive = true; |
27 } else { | 27 } else { |
28 String file = args[i++]; | 28 String file = args[i++]; |
29 try { | 29 try { |
30 LuaFunction fn = BasicLib.loadFile(file); | 30 LuaFunction fn = BasicLib.loadFile(lua,file); |
31 fn.call(lua); | 31 fn.call(lua); |
32 } catch(LuaException e) { | 32 } catch(LuaException e) { |
33 // System.out.println(e.getMessage()); | 33 // System.out.println(e.getMessage()); |
34 e.printStackTrace(); | 34 e.printStackTrace(); |
35 return; | 35 return; |
42 static void interactive(LuaState lua) { | 42 static void interactive(LuaState lua) { |
43 while( true ) { | 43 while( true ) { |
44 System.out.print("> "); | 44 System.out.print("> "); |
45 String input = new Scanner(System.in).nextLine(); | 45 String input = new Scanner(System.in).nextLine(); |
46 try { | 46 try { |
47 LuaFunction fn = BasicLib.load(input); | 47 LuaFunction fn = BasicLib.load(lua,input); |
48 Object[] rtn = fn.call(lua); | 48 Object[] rtn = fn.call(lua); |
49 if( rtn.length > 0 ) | 49 if( rtn.length > 0 ) |
50 BasicLib.print(rtn); | 50 BasicLib.print(rtn); |
51 } catch(LuaException e) { | 51 } catch(LuaException e) { |
52 System.out.println(e.getMessage()); | 52 System.out.println(e.getMessage()); |