Mercurial Hosting > luan
comparison core/src/luan/LuanBit.java @ 423:1eafb11a150d
remove Luan.repr()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 16:30:28 -0600 |
parents | b31d614343e8 |
children | e3a6d9dbd694 |
comparison
equal
deleted
inserted
replaced
422:af82b266fe89 | 423:1eafb11a150d |
---|---|
102 } | 102 } |
103 } | 103 } |
104 return Luan.toString(obj); | 104 return Luan.toString(obj); |
105 } | 105 } |
106 | 106 |
107 public String repr(Object obj) throws LuanException { | |
108 if( obj == null ) | |
109 return "nil"; | |
110 if( obj instanceof Boolean ) | |
111 return Luan.toString((Boolean)obj); | |
112 if( obj instanceof Number ) | |
113 return Luan.toString((Number)obj); | |
114 if( obj instanceof String ) | |
115 return "\"" + Luan.stringEncode((String)obj) + "\""; | |
116 if( obj instanceof LuanRepr ) | |
117 return ((LuanRepr)obj).repr(luan); | |
118 throw exception( "value '" + obj + "' doesn't support repr()" ); | |
119 } | |
120 | |
121 public LuanFunction getHandlerFunction(String op,LuanTable t) throws LuanException { | 107 public LuanFunction getHandlerFunction(String op,LuanTable t) throws LuanException { |
122 Object f = t.getHandler(op); | 108 Object f = t.getHandler(op); |
123 if( f == null ) | 109 if( f == null ) |
124 return null; | 110 return null; |
125 return checkFunction(f); | 111 return checkFunction(f); |