Mercurial Hosting > luan
changeset 199:8960c81eb4bc
minor
git-svn-id: https://luan-java.googlecode.com/svn/trunk@200 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 03 Jul 2014 21:37:47 +0000 |
parents | 390210409719 |
children | 9fb218211763 |
files | core/src/luan/LuanState.java |
diffstat | 1 files changed, 41 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
diff -r 390210409719 -r 8960c81eb4bc core/src/luan/LuanState.java --- a/core/src/luan/LuanState.java Thu Jul 03 20:52:55 2014 +0000 +++ b/core/src/luan/LuanState.java Thu Jul 03 21:37:47 2014 +0000 @@ -12,53 +12,14 @@ public abstract class LuanState implements DeepCloneable<LuanState> { - private final LuanBit JAVA = bit(LuanElement.JAVA); - public LuanException exception(Object msg) { - return JAVA.exception(msg); - } - - public Object call(LuanFunction fn) throws LuanException { - return call(fn,null,LuanFunction.NOTHING); - } - - public Object call(LuanFunction fn,String fnName) throws LuanException { - return call(fn,fnName,LuanFunction.NOTHING); - } - - public Object call(LuanFunction fn,Object[] args) throws LuanException { - return call(fn,null,args); - } - - public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { - return JAVA.call(fn,fnName,args); - } - - public LuanFunction checkFunction(Object obj) throws LuanException { - return JAVA.checkFunction(obj); - } - - public String toString(Object obj) throws LuanException { - return JAVA.toString(obj); - } - - public String repr(Object obj) throws LuanException { - return JAVA.repr(obj); - } - - public boolean isLessThan(Object o1,Object o2) throws LuanException { - return JAVA.isLessThan(o1,o2); - } - - + final List<StackTraceElement> stackTrace = new ArrayList<StackTraceElement>(); private LuanTable global; private LuanTable loaded; private LuanTable preload; private LuanTable searchers; - final List<StackTraceElement> stackTrace = new ArrayList<StackTraceElement>(); - protected LuanState() { global = new LuanTable(); global.put("_G",global); @@ -156,4 +117,44 @@ return t==null ? null : t.get(op); } + + // convenience methods + + private final LuanBit JAVA = bit(LuanElement.JAVA); + + public LuanException exception(Object msg) { + return JAVA.exception(msg); + } + + public Object call(LuanFunction fn) throws LuanException { + return call(fn,null,LuanFunction.NOTHING); + } + + public Object call(LuanFunction fn,String fnName) throws LuanException { + return call(fn,fnName,LuanFunction.NOTHING); + } + + public Object call(LuanFunction fn,Object[] args) throws LuanException { + return call(fn,null,args); + } + + public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { + return JAVA.call(fn,fnName,args); + } + + public LuanFunction checkFunction(Object obj) throws LuanException { + return JAVA.checkFunction(obj); + } + + public String toString(Object obj) throws LuanException { + return JAVA.toString(obj); + } + + public String repr(Object obj) throws LuanException { + return JAVA.repr(obj); + } + + public boolean isLessThan(Object o1,Object o2) throws LuanException { + return JAVA.isLessThan(o1,o2); + } }