A table which can process a stream of bytes. A stream can be used to read and write to files. They can read/write both binary and ASCII files.
Create a Stream.
Sig: stream = Stream.Create()
- Ret:
Stream stream
Newly created stream
Get the size of the Stream in bytes.
Sig: size = Stream:GetSize()
- Ret:
integer size
Size in bytes
Get the Stream cursor position (byte offset where we are reading from or writing to).
Sig: pos = Stream:GetPos()
- Ret:
integer pos
Cursor position
Set the Stream cursor position (byte offset where we are reading from or writing to).
Sig: Stream:SetPos(pos)
- Arg:
integer pos
Cursor position
Read the bytes from a file and store them in this Stream.
Sig: Stream:ReadFile(path, maxSize=0)
- Arg:
string path
File path - Arg:
integer maxSize
Max number of bytes to store in Stream (0 = no limit).
Write the contents of this Stream to a file.
Sig: Stream:WriteFile(path)
- Arg:
string path
File path
Read an asset descriptor from the Stream.
Sig: asset = Stream:ReadAsset()
- Ret:
Asset asset
Asset
Write an asset descriptor to the Stream.
Sig: Stream:WriteAsset(asset)
- Arg:
Asset asset
Asset
Read a string from the Stream.
Sig: str = Stream:ReadString()
- Ret:
string str
String
Write a string to the Stream.
Sig: Stream:WriteString(str)
- Arg:
string str
String
Read a 32-bit integer from the Stream.
Sig: int = Stream:ReadInt32()
- Ret:
integer int
Integer
Read a 16-bit integer from the Stream.
Sig: int = Stream:ReadInt16()
- Ret:
integer int
Integer
Read an 8-bit integer from the Stream.
Sig: int = Stream:ReadInt8()
- Ret:
integer int
Integer
Read a floating-point number from the Stream.
Sig: float = Stream:ReadFloat()
- Ret:
number float
Float
Read a boolean from the Stream.
Sig: bool = Stream:ReadBool()
- Ret:
boolean bool
Boolean
Read a 2-component Vector from the Stream.
Sig: vec = Stream:ReadVec2()
- Ret:
Vector vec
Vector
Read a 3-component Vector from the Stream.
Sig: vec = Stream:ReadVec3()
- Ret:
Vector vec
Vector
Read a 4-component Vector from the Stream.
Sig: vec = Stream:ReadVec4()
- Ret:
Vector vec
Vector
Write a 32-bit integer to the Stream.
Sig: Stream:WriteInt32(int)
- Arg:
integer int
Integer
Write a 16-bit integer to the Stream.
Sig: Stream:WriteInt16(int)
- Arg:
integer int
Integer
Write an 8-bit integer to the Stream.
Sig: Stream:WriteInt8(int)
- Arg:
integer int
Integer
Write a floating-point number to the Stream.
Sig: Stream:WriteFloat(float)
- Arg:
number float
Float
Write a boolean to the Stream.
Sig: Stream:WriteBool(bool)
- Arg:
boolean bool
Boolean
Write a 2-component Vector to the Stream.
Sig: Stream:WriteVec2(vec)
- Arg:
Vector vec
Vector
Write a 3-component Vector to the Stream.
Sig: Stream:WriteVec3(vec)
- Arg:
Vector vec
Vector
Write a 4-component Vector to the Stream.
Sig: Stream:WriteVec4(vec)
- Arg:
Vector vec
Vector