Data

Data is not creatable, there's only one instance of it. It can only be accessed through its globally exposed variable.

Data is used to transfer raw pieces of information.
It is possible to access any byte of a Data instances using [].

How to read a specific byte of a Data instance?

File:OpenAndReadAll(function(success, result)
  local data = result
  -- get the value of the 5th byte as a number
  local val = data[5]
end)

Functions

Returns the data as a string.

File:OpenAndReadAll(function(success, result)
  -- result type is Data
  local data = result
  local str = data:ToString()
  if string.sub(str, 1, 6) == "CUBZH!" then
    print("It's a Cubzh file!")
  end
end)

Properties

Number of bytes the Data contains.

HTTP:Get("cu.bzh", function(result)
-- result type is Data
  for i = 1, result.Len do
    -- goes through every byte of the provided Data
  end
end)