0
votes

I'm making a chat program using a flat buffer. I want to move four ball variables. ex) value1 = true, value2 = false, value3 = true, value = false,

The schema name of Flatbuffers is ServerInfo.

(i = 0; i  < 3; i++)
ServerInfo.AddValue(fb, value [i]);

I wrote this code. A total of four values should be added, but only one was added.

The result I want) true, false, true, false. Actual Results ) true, true, true, true

The ServerInfo value.value portion of the test [i] was the same as the value [0]. How can we put it together once?

Definition of ServerInfo.AddValue.

public static space addValue (FlatBufferBufferBufferBufferBufferBuilder) {builder.AddBool(4, Value, false); }
1

1 Answers

0
votes

You are setting the same scalar field 4 times. Not sure what language you're doing this in, but that should result in an assert. If you want to store 4 values, replace bool in your schema with [bool].

I am guessing you're coming from Protobuf and expecting each field to be repeated?