Mercurial Hosting > luan
comparison core/src/luan/modules/RpcLuan.java @ 759:ae612dfc57cb 0.21
better handling of longs in rpc and json
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 19 Jul 2016 09:09:41 -0600 |
parents | c29d11d675fd |
children |
comparison
equal
deleted
inserted
replaced
758:c29d11d675fd | 759:ae612dfc57cb |
---|---|
30 private static final int BOOLEAN = 2; | 30 private static final int BOOLEAN = 2; |
31 private static final int NUMBER = 3; | 31 private static final int NUMBER = 3; |
32 private static final int BINARY = 4; | 32 private static final int BINARY = 4; |
33 private static final int TABLE = 5; | 33 private static final int TABLE = 5; |
34 private static final int IO = 6; | 34 private static final int IO = 6; |
35 private static final int LONG = 7; | |
35 | 36 |
36 @LuanMethod public static Object[] call(LuanState luan,LuanTable socketTbl,String fnName,Object... args) | 37 @LuanMethod public static Object[] call(LuanState luan,LuanTable socketTbl,String fnName,Object... args) |
37 throws LuanException, IOException | 38 throws LuanException, IOException |
38 { | 39 { |
39 IoLuan.LuanSocket luanSocket = (IoLuan.LuanSocket)socketTbl.rawGet("java"); | 40 IoLuan.LuanSocket luanSocket = (IoLuan.LuanSocket)socketTbl.rawGet("java"); |
132 } | 133 } |
133 else if( obj instanceof Boolean ) { | 134 else if( obj instanceof Boolean ) { |
134 out.write(BOOLEAN); | 135 out.write(BOOLEAN); |
135 writeBoolean(out,(Boolean)obj); | 136 writeBoolean(out,(Boolean)obj); |
136 } | 137 } |
138 else if( obj instanceof Long ) { | |
139 out.write(LONG); | |
140 writeString(out,obj.toString()); | |
141 } | |
137 else if( obj instanceof Number ) { | 142 else if( obj instanceof Number ) { |
138 out.write(NUMBER); | 143 out.write(NUMBER); |
139 writeString(out,obj.toString()); | 144 writeString(out,obj.toString()); |
140 } | 145 } |
141 else if( obj instanceof byte[] ) { | 146 else if( obj instanceof byte[] ) { |
161 return null; | 166 return null; |
162 case STRING: | 167 case STRING: |
163 return readString(in); | 168 return readString(in); |
164 case BOOLEAN: | 169 case BOOLEAN: |
165 return readBoolean(in); | 170 return readBoolean(in); |
171 case LONG: | |
172 return Long.valueOf(readString(in)); | |
166 case NUMBER: | 173 case NUMBER: |
167 return Double.valueOf(readString(in)); | 174 return Double.valueOf(readString(in)); |
168 case BINARY: | 175 case BINARY: |
169 return readBinary(in,readInt(in)); | 176 return readBinary(in,readInt(in)); |
170 case TABLE: | 177 case TABLE: |