If a table has numeric indices, and one of the values is
nil
, that index and its subsequent indices are lost. In the following code example, themessage
table has[3] = nil
, so that index and[4] = "Goodbye world!"
are lost in the transmission.
It is claimed that all after a nil
, all values are ignored. This does not seem to be the case, even using the example code it shows the value at index 4 in the output. It appears that these values being ignored depends upon how the table was constructed, and is closely related to how the #
operator works. For example, adding [5] = nil
to the example will cause index 4 to not be sent, but additionally adding [6] = nil
will cause index 4 to be sent, which seems to align with the behavior with the #
operator.
The documentation should make it clear that values after a nil
may or may not be removed.
If you pass a table with a mix of numeric and string keys, the values indexed by string keys are lost. In the following code sample,
colorData
is a mixed table. When the server receivescolorData
, it receives only indices[1]
and[2]
containing"Blue"
and"Yellow"
. The remaining data is lost.
Sometimes, if index 1 is nil in the array part (seems to be connected to the #
operator again) then it will decide to provide the string keys and the numeric keys converted to strings.
The documentation should make it clear that providing numeric keys where the first index is nil might cause the string keys to be sent, and the numeric keys to be converted to string keys.
If any indices of a passed table are non-string types such as an
Instance
, userdata, or function, Roblox automatically converts those indices to strings.
The documentation should make it clear that the format used for these conversions is unspecified, for example it seems that numbers are converted to signed 64 bit integers before converting to a string. Nothing is stated about when one of the strings from the conversions overlaps with a string key in the table or another string from the conversions. It should be mentioned that in such cases, the value for this string will be any of the values from the possible keys (it probably depends upon how the table was constructed).
There are also some types that are not valid to send over remote events or functions, such as TweenInfo
, RaycastParams
, CatalogSearchParams
, RotationCurveKey
, FloatCurveKey
, DockWidgetPluginGuiInfo
, PluginDrag
, CellId
, and RaycastResult
. Some types cannot be sent over remote or bindable events or functions, such as Random
and OverlapParams
. A list of invalid types to send should be provided.
Page URL: https://create.roblox.com/docs/scripting/events/argument-limitations-for-bindables-and-remotes