- function _SCPLib_Message::GetBoolData(index)
- // Get bool data at the index position in Data. If Data doesn't exist or the
- // index is invalid, null is returned. If data exist, but is not of the type
- // integer, null will be returned. Yes, it is not a typo. Bools are transmitted
- // as integers, however this function does check that the received integer is
- // 0 or 1, otherwise null is returned as well.
- // @param index position in the Data array to grab
- // @return Data[index] if it exist and is of the type integer and is 0 or 1, otherwise null
- {
- if (this.Data != null &&
- this.Data.len() > index &&
- typeof(this.Data[index]) == "integer" &&
- (this.Data[index] == 0 || this.Data[index] == 1))
- {
- return this.Data[index] == 1;
- }
- return null;
- }