comparison src/luan/lib/StringLib.java @ 77:4bf3d0c0b6b9

make LuanState cloneable git-svn-id: https://luan-java.googlecode.com/svn/trunk@78 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 15 Feb 2013 09:55:17 +0000
parents f003338d503b
children 805929c3c6e1
comparison
equal deleted inserted replaced
76:97b03fc807ad 77:4bf3d0c0b6b9
16 public static final String NAME = "string"; 16 public static final String NAME = "string";
17 17
18 public static final LuanFunction LOADER = new LuanFunction() { 18 public static final LuanFunction LOADER = new LuanFunction() {
19 public Object[] call(LuanState luan,Object[] args) throws LuanException { 19 public Object[] call(LuanState luan,Object[] args) throws LuanException {
20 LuanTable module = new LuanTable(); 20 LuanTable module = new LuanTable();
21 LuanTable global = luan.global; 21 LuanTable global = luan.global();
22 try { 22 try {
23 module.put( "byte", new LuanJavaFunction(StringLib.class.getMethod("byte_",String.class,Integer.class,Integer.class),null) ); 23 module.put( "byte", new LuanJavaFunction(StringLib.class.getMethod("byte_",String.class,Integer.class,Integer.class),null) );
24 module.put( "char", new LuanJavaFunction(StringLib.class.getMethod("char_",new byte[0].getClass()),null) ); 24 module.put( "char", new LuanJavaFunction(StringLib.class.getMethod("char_",new byte[0].getClass()),null) );
25 add( module, "find", String.class, String.class, Integer.class, Boolean.class ); 25 add( module, "find", String.class, String.class, Integer.class, Boolean.class );
26 add( module, "gmatch", String.class, String.class ); 26 add( module, "gmatch", String.class, String.class );