diff --git a/luna/src/main/java/org/classdump/luna/StringByteString.java b/luna/src/main/java/org/classdump/luna/StringByteString.java index b19bae1f..2b0e2d09 100644 --- a/luna/src/main/java/org/classdump/luna/StringByteString.java +++ b/luna/src/main/java/org/classdump/luna/StringByteString.java @@ -64,6 +64,10 @@ class StringByteString extends ByteString { return true; } + if (that instanceof StringByteString tstring) { + return string.equals(tstring.string); + } + // don't force hashCode computation, but use if already known int thisHash = this.maybeHashCode(); int thatHash = that.maybeHashCode(); diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/lua/Conversions.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/lua/Conversions.kt index 1a116f5b..d0b12084 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/lua/Conversions.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/lua/Conversions.kt @@ -230,9 +230,11 @@ private object JsonTableIndex : AbstractFunction3() { throw NonsuspendableFunctionException(this::class.java) } + private val __nils: ByteString = ByteString.of("__nils") + override fun invoke(context: ExecutionContext, self: Table, key: Any, value: Any?) { val meta = self.metatable - val nils = meta["__nils"] as Table + val nils = meta[__nils] as Table // If we are setting an entry to nil, need to add a bogus integer entry // to the __nils table, otherwise need to set the entry *in* the __nils