Merge pull request #21 from lorenzos/patch-1

Check the type before reusing a NumberValueEntry
This commit was merged in pull request #21.
This commit is contained in:
Enyby
2018-11-02 23:11:36 +02:00
committed by GitHub

View File

@@ -1246,13 +1246,14 @@ public class LuaTable extends LuaValue implements Metatable {
} }
public Entry set(LuaValue value) { public Entry set(LuaValue value) {
LuaValue n = value.tonumber(); if (value.type() == TNUMBER) {
if ( !n.isnil() ) { LuaValue n = value.tonumber();
this.value = n.todouble(); if (!n.isnil()) {
return this; this.value = n.todouble();
} else { return this;
return new NormalEntry( this.key, value ); }
} }
return new NormalEntry( this.key, value );
} }
public int keyindex( int mask ) { public int keyindex( int mask ) {