Mercurial Hosting > luan
comparison src/luan/lib/IoLib.java @ 118:735708619119
add Debug.debug()
git-svn-id: https://luan-java.googlecode.com/svn/trunk@119 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 01 Jun 2014 07:07:31 +0000 |
parents | 1ff1c32417eb |
children | d00f41edbbd6 |
comparison
equal
deleted
inserted
replaced
117:e935581cf9fb | 118:735708619119 |
---|---|
32 try { | 32 try { |
33 add( module, "file", String.class ); | 33 add( module, "file", String.class ); |
34 add( module, "java_resource_to_url", String.class ); | 34 add( module, "java_resource_to_url", String.class ); |
35 add( module, "url", String.class ); | 35 add( module, "url", String.class ); |
36 add( module, "java_resource", String.class ); | 36 add( module, "java_resource", String.class ); |
37 add( module, "read_console_line", String.class ); | |
37 | 38 |
38 LuanTable stdin = new LuanTable(); | 39 LuanTable stdin = new LuanTable(); |
39 stdin.put( "read_text", new LuanJavaFunction( | 40 stdin.put( "read_text", new LuanJavaFunction( |
40 IoLib.class.getMethod( "stdin_read_text" ), null | 41 IoLib.class.getMethod( "stdin_read_text" ), null |
41 ) ); | 42 ) ); |
218 return url==null ? null : url.toString(); | 219 return url==null ? null : url.toString(); |
219 } | 220 } |
220 | 221 |
221 public static LuanTable java_resource(String path) throws IOException { | 222 public static LuanTable java_resource(String path) throws IOException { |
222 return url(java_resource_to_url(path)); | 223 return url(java_resource_to_url(path)); |
224 } | |
225 | |
226 public static String read_console_line(String prompt) throws IOException { | |
227 if( prompt==null ) | |
228 prompt = "> "; | |
229 return System.console().readLine(prompt); | |
223 } | 230 } |
224 | 231 |
225 | 232 |
226 public interface LuanWriter { | 233 public interface LuanWriter { |
227 public void write(LuanState luan,Object... args) throws LuanException, IOException; | 234 public void write(LuanState luan,Object... args) throws LuanException, IOException; |