Mercurial Hosting > luan
comparison src/luan/LuanState.java @ 130:0594c132888b
cleanup
git-svn-id: https://luan-java.googlecode.com/svn/trunk@131 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 10 Jun 2014 02:43:40 +0000 |
parents | f0a4abe58593 |
children | 3119326260ea |
comparison
equal
deleted
inserted
replaced
129:486a0641bca4 | 130:0594c132888b |
---|---|
18 import luan.lib.IoLib; | 18 import luan.lib.IoLib; |
19 import luan.lib.ThreadLib; | 19 import luan.lib.ThreadLib; |
20 | 20 |
21 | 21 |
22 public abstract class LuanState implements DeepCloneable<LuanState> { | 22 public abstract class LuanState implements DeepCloneable<LuanState> { |
23 public final LuanBit JAVA = bit(LuanElement.JAVA); | 23 private final LuanBit JAVA = bit(LuanElement.JAVA); |
24 | |
25 public LuanException exception(Object msg) { | |
26 return JAVA.exception(msg); | |
27 } | |
28 | |
29 public Object call(LuanFunction fn) throws LuanException { | |
30 return call(fn,null,LuanFunction.NOTHING); | |
31 } | |
32 | |
33 public Object call(LuanFunction fn,String fnName) throws LuanException { | |
34 return call(fn,fnName,LuanFunction.NOTHING); | |
35 } | |
36 | |
37 public Object call(LuanFunction fn,Object[] args) throws LuanException { | |
38 return call(fn,null,args); | |
39 } | |
40 | |
41 public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { | |
42 return JAVA.call(fn,fnName,args); | |
43 } | |
44 | |
45 public LuanFunction checkFunction(Object obj) throws LuanException { | |
46 return JAVA.checkFunction(obj); | |
47 } | |
48 | |
49 public String toString(Object obj) throws LuanException { | |
50 return JAVA.toString(obj); | |
51 } | |
52 | |
53 public String repr(Object obj) throws LuanException { | |
54 return JAVA.repr(obj); | |
55 } | |
56 | |
57 public boolean isLessThan(Object o1,Object o2) throws LuanException { | |
58 return JAVA.isLessThan(o1,o2); | |
59 } | |
60 | |
61 | |
24 | 62 |
25 private LuanTable global; | 63 private LuanTable global; |
26 private LuanTable loaded; | 64 private LuanTable loaded; |
27 private LuanTable preload; | 65 private LuanTable preload; |
28 private LuanTable searchers; | 66 private LuanTable searchers; |
118 } catch(LuanException e) { | 156 } catch(LuanException e) { |
119 throw new RuntimeException(e); | 157 throw new RuntimeException(e); |
120 } | 158 } |
121 } | 159 } |
122 | 160 |
123 public final Object eval(String cmd,String sourceName,boolean allowExpr) throws LuanException { | 161 public final Object eval(String cmd) throws LuanException { |
124 LuanFunction fn = BasicLib.load(this,cmd,sourceName,true,allowExpr); | 162 LuanFunction fn = BasicLib.load(this,cmd,"eval",true,true); |
125 return JAVA.call(fn,null); | 163 return call(fn); |
126 } | 164 } |
127 | 165 |
128 | 166 |
129 public final LuanTable getMetatable(Object obj) { | 167 public final LuanTable getMetatable(Object obj) { |
130 if( obj instanceof LuanTable ) { | 168 if( obj instanceof LuanTable ) { |