mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-17 01:26:45 +00:00
[Kotlin] Fix key lookup returning null clashing with default value (#7237)
* [Java] Fix key lookup returning null clashing with default value A field with key attribute must always be written on the message so it can be looked up by key. There is a edge case where inserting a key field with same value as default would prevent it to be written on the message and later cannot be found when searched by key. * [Kotlin] Fix key lookup returning null clashing with default value A field with key attribute must always be written on the message so it can be looked up by key. There is a edge case where inserting a key field with same value as default would prevent it to be written on the message and later cannot be found when searched by key. Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -885,7 +885,10 @@ class Monster : Table() {
|
||||
fun addPos(builder: FlatBufferBuilder, pos: Int) = builder.addStruct(0, pos, 0)
|
||||
fun addMana(builder: FlatBufferBuilder, mana: Short) = builder.addShort(1, mana, 150)
|
||||
fun addHp(builder: FlatBufferBuilder, hp: Short) = builder.addShort(2, hp, 100)
|
||||
fun addName(builder: FlatBufferBuilder, name: Int) = builder.addOffset(3, name, 0)
|
||||
fun addName(builder: FlatBufferBuilder, name: Int) {
|
||||
builder.addOffset(name)
|
||||
builder.slot(3)
|
||||
}
|
||||
fun addInventory(builder: FlatBufferBuilder, inventory: Int) = builder.addOffset(5, inventory, 0)
|
||||
fun createInventoryVector(builder: FlatBufferBuilder, data: UByteArray) : Int {
|
||||
builder.startVector(1, data.size, 1)
|
||||
|
||||
Reference in New Issue
Block a user