Mercurial Hosting > luan
comparison core/src/luan/impl/SetTableEntry.java @ 511:e3fb9768dbb3
better error messages
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 22 May 2015 10:47:56 -0600 |
parents | 92c3d22745b8 |
children | f1601a4ce1aa |
comparison
equal
deleted
inserted
replaced
510:2da0bcb979b5 | 511:e3fb9768dbb3 |
---|---|
4 import luan.LuanTable; | 4 import luan.LuanTable; |
5 import luan.Luan; | 5 import luan.Luan; |
6 import luan.LuanFunction; | 6 import luan.LuanFunction; |
7 import luan.LuanElement; | 7 import luan.LuanElement; |
8 import luan.LuanMeta; | 8 import luan.LuanMeta; |
9 import luan.LuanBit; | |
9 import luan.modules.JavaLuan; | 10 import luan.modules.JavaLuan; |
10 | 11 |
11 | 12 |
12 final class SetTableEntry extends CodeImpl implements Settable { | 13 final class SetTableEntry extends CodeImpl implements Settable { |
13 private final Expr tableExpr; | 14 private final Expr tableExpr; |
27 if( t instanceof LuanTable ) { | 28 if( t instanceof LuanTable ) { |
28 LuanTable tbl = (LuanTable)t; | 29 LuanTable tbl = (LuanTable)t; |
29 tbl.put(luan,key,value); | 30 tbl.put(luan,key,value); |
30 return; | 31 return; |
31 } | 32 } |
33 LuanBit bit = luan.bit(el()); | |
32 if( t != null && luan.hasJava() ) | 34 if( t != null && luan.hasJava() ) |
33 JavaLuan.__new_index(luan,t,key,value); | 35 JavaLuan.__new_index(bit,t,key,value); |
34 else | 36 else |
35 throw luan.bit(el).exception( "attempt to index '"+tableExpr.el().text()+"' (a " + Luan.type(t) + " value)" ); | 37 throw bit.exception( "attempt to index a " + Luan.type(t) + " value in '"+bit.el.text()+"'" ); |
36 } | 38 } |
37 | 39 |
38 } | 40 } |