Mercurial Hosting > luan
comparison src/luan/interp/Utils.java @ 36:2a35154aec14
implement more basic lib functions
git-svn-id: https://luan-java.googlecode.com/svn/trunk@37 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 18 Dec 2012 09:53:42 +0000 |
parents | e51906de0f11 |
children | 8a57ebfdfd78 |
comparison
equal
deleted
inserted
replaced
35:e51906de0f11 | 36:2a35154aec14 |
---|---|
11 | 11 |
12 static Object first(Object[] a) { | 12 static Object first(Object[] a) { |
13 return a.length==0 ? null : a[0]; | 13 return a.length==0 ? null : a[0]; |
14 } | 14 } |
15 | 15 |
16 static final Object getHandlerObject(String op,Object obj) throws LuaException { | 16 static final Object getHandler(String op,Object obj) throws LuaException { |
17 LuaTable t = Lua.getMetatable(obj); | 17 LuaTable t = Lua.getMetatable(obj); |
18 return t==null ? null : t.get(op); | 18 return t==null ? null : t.get(op); |
19 } | 19 } |
20 | 20 |
21 static final LuaFunction getHandler(String op,Object obj) throws LuaException { | 21 static final LuaFunction getHandlerFunction(String op,Object obj) throws LuaException { |
22 Object f = getHandlerObject(op,obj); | 22 Object f = getHandler(op,obj); |
23 if( f == null ) | 23 if( f == null ) |
24 return null; | 24 return null; |
25 return Lua.checkFunction(f); | 25 return Lua.checkFunction(f); |
26 } | 26 } |
27 | 27 |