Mercurial Hosting > luan
comparison core/src/luan/modules/BinaryLuan.java @ 426:23a93c118042
fix LuanTable.get() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 18:44:20 -0600 |
parents | abce9b0041b0 |
children | e3b0846dc2ef |
comparison
equal
deleted
inserted
replaced
425:0a2fb80907f9 | 426:23a93c118042 |
---|---|
10 | 10 |
11 public final class BinaryLuan { | 11 public final class BinaryLuan { |
12 | 12 |
13 public static Object __index(LuanState luan,final byte[] binary,Object key) throws LuanException { | 13 public static Object __index(LuanState luan,final byte[] binary,Object key) throws LuanException { |
14 LuanTable mod = (LuanTable)PackageLuan.require(luan,"luan:Binary"); | 14 LuanTable mod = (LuanTable)PackageLuan.require(luan,"luan:Binary"); |
15 Object obj = mod.get(key); | 15 Object obj = mod.get(luan,key); |
16 if( obj instanceof LuanFunction ) { | 16 if( obj instanceof LuanFunction ) { |
17 final LuanFunction fn = (LuanFunction)obj; | 17 final LuanFunction fn = (LuanFunction)obj; |
18 return new LuanFunction() { | 18 return new LuanFunction() { |
19 @Override public Object call(LuanState luan,Object[] args) throws LuanException { | 19 @Override public Object call(LuanState luan,Object[] args) throws LuanException { |
20 Object[] a = new Object[args.length+1]; | 20 Object[] a = new Object[args.length+1]; |