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 .
File:OpenAndReadAll(function(success, result) local data = result -- get the value of the 5th byte as a number local val = data end)
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)
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)