Mercurial Hosting > luan
diff src/luan/Lua.java @ 35:e51906de0f11
implement metatables
git-svn-id: https://luan-java.googlecode.com/svn/trunk@36 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 18 Dec 2012 07:05:58 +0000 |
parents | 8217d8485715 |
children | 2a35154aec14 |
line wrap: on
line diff
--- a/src/luan/Lua.java Sun Dec 16 09:23:56 2012 +0000 +++ b/src/luan/Lua.java Tue Dec 18 07:05:58 2012 +0000 @@ -2,6 +2,7 @@ public class Lua { + public static final String version = "Luan 0.0"; public static String type(Object obj) { if( obj == null ) @@ -63,4 +64,11 @@ throw new LuaException( "attempt to call a " + type(obj) + " value" ); } + public static LuaTable getMetatable(Object obj) { + if( !(obj instanceof LuaTable) ) + return null; + LuaTable table = (LuaTable)obj; + return table.getMetatable(); + } + }