PSHomeCacheDepot / DEV /1.86 Docs /Libraries /MemoryContainer.txt
pebxcvi's picture
big update
d7bb13e
1.43 MemoryContainer .
1.43.1 MemoryContainer.Create .
1.43.2 MemoryContainer.DebugLoad .
1.43.3 MemoryContainer.DebugPrint .
1.43.4 MemoryContainer.DebugSave .
1.43.5 MemoryContainer.GetBiglnt .
1.43.6 MemoryContainer.GetBit .
1.43.7 MemoryContainer.GetBits .
1.43.8 MemoryContainer.GetFloat16 .
1.43.9 MemoryContainer.GetFloat32 .
1.43.10 MemoryContainer.Getlnt8 .
1.43.11 MemoryContainer.Getlntl 6 .
1.43.12 MemoryContainer.GetSize .
1.43.13 MemoryContainer.GetString .
1.43.14 MemoryContainer.GetUlnt8.
1.43.15 MemoryContainer.GetUIntl 6.
1.43.16 MemoryContainer.GetUsedSize .
1.43.17 MemoryContainer.MemCopy .
1.43.18 MemoryContainer.MemSet .
1.43.19 MemoryContainer.ReadBiglnt .
1.43.20 MemoryContainer.ReadFloatl 6 .
1.43.21 MemoryContainer.ReadFloat32 .
1.43.22 MemoryContainer.Readlnt8 .
1.43.23 MemoryContainer.Readlntl 6 .
1.43.24 MemoryContainer.ReadString .
1.43.25 MemoryContainer.ReadUlnt8 .
1.43.26 MemoryContainer.ReadUIntl 6 .
1.43.27 MemoryContainer.Reset .
1.43.28 MemoryContainer.Seek .
1.43.29 MemoryContainer.SetBiglnt .
1.43.30 MemoryContainer.SetBit .
1.43.31 MemoryContainer.SetBits .
1.43.32 MemoryContainer.SetFloatl 6 .
1.43.33 MemoryContainer.SetFloat32 .
1.43.34 MemoryContainer.Setlnt8 .
1.43.35 MemoryContainer.Setlnt16 .
1.43.36 MemoryContainer.SetString .
1.43.37 MemoryContainer.SetUsedSize .
1.43.38 MemoryContainer.Tell .
1.43.39 MemoryContainer.WriteBiglnt .
1.43.40 MemoryContainer.WriteFloatl 6.
1.43.41 MemoryContainer.WriteFloat32.
1.43.42 MemoryContainer.Writelnt8.
1.43.43 MemoryContainer.Writelntl 6.
1.43.44 MemoryContainer.WriteString .
MemoryContainer
MemoryContainer.Create
Brief
Creates a new memory container.
Definition
MemoryContainer MemoryContainer.Create( number size, MemoryType memType = MemoryType.Main, number
alignment = 1 )
MemoryContainer MemoryContainer.Create( Resource resource )
Arguments
size - The size in bytes of the memory container.resource - A loaded file resource or based from a file resource.memType - Type of memory to
allocate.alignment - Required alignment of the memory container start address, in bytes. Must be a power of 2.
Return Values
A new instance of a memory container.
Description
Creates a new memory container. A memory container is an allocated block of memory where other library functions can output data. For
example, the BasicGenx library uses a memory container to output XML which can then be posted to a server via the FlttpPostData library. If
creating a memory container from a resource the memory container is read only and errors will occur if attempting to write to it. Note that only file
resources are accepted; textures, soundstreams and other resource types will generate an error. The container will be allocated from the script's
memory budget.
Examples
container = MemoryContainer.Create ( 4096 )
hostContainer = MemoryContainer.Create( 8192, MemoryType.Host )
myResource = Resource.Find("myFile")
resourceContainer = MemoryContainer.Create( myResource )
See Also
� BasicGenx.Create
� FlttpPostData.Create
MemoryContainer.DebugLoad
Brief
Loads the contents of a file into a memory container from the host PC.
Definition
boolean MemoryContainer.DebugLoad( MemoryContainer container, string filename )
Arguments
container - The instance of the memory container.filename - The name of the file to load
Return Values
True if the file loaded successfully, false otherwise.
Description
Loads the contents of a file into a memory container from the host PC.
Examples
! me = MemoryContainer.Create( 100 )
: MemoryContainer.DebugPrint( me, "d:/temp/mc.dat" )
See Also
� MemoryContainer.Create
MemoryContainer.Debug Print
Brief
Prints the contents of the container to the tty for debugging.
Definition
MemoryContainer.DebugPrint( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
None.
Description
Prints the contents of the container to the tty for debugging.
Examples
! me = MemoryContainer.Create( 100 )
! MemoryContainer.SetFloat( me, 5, 123.12 )
| MemoryContainer.DebugPrint( me )
See Also
� MemoryContainer.Create
MemoryContainer.DebugSave
Brief
Saves the contents of a memory container to a file on the host PC.
Definition
MemoryContainer.DebugSave( MemoryContainer container, string filename )
Arguments
container - The instance of the memory container.filename - The name of the file to save
Return Values
None.
Description
Saves the contents of a memory container to a file on the host PC.
Examples
me = MemoryContainer.Create( 100 )
1 MemoryContainer.DebugSave( me, "d:/temp/mc.dat" )
See Also
� MemoryContainer.Create
MemoryContainer.GetBiglnt
Brief
Obtains the data at the specified byte index as a Biglnt value.
Definition
! void Memory-Container.GetBiglnt( MemoryContainer container, number bytelndex, Biglnt result )
Arguments
container - The instance of the memory container.bytelndex - The byte index.result - Biglnt to store value
Return Values
None.
Description
If there is insufficient data to read the entire size of the Biglnt value an error will result (for example, if there are 32 bits of data remaining but the
Biglnt is 64 bits in size, the function will fail).
Examples
me = MemoryContainer.Create ( 100 )
| i = Biglnt.Create (64)
| MemoryContainer.GetBiglnt( me, 8, i )
See Also
� MemoryContainer.Create
� Biglnt.Create
MemoryContainer.GetBit
Brief
Returns the value of the specified bit as a boolean.
Definition
! boolean MemoryContainer.GetBit( MemoryContainer container, number bytelndex, number bitlndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.bitlndex - The bit index, starts at 0 and if it is 8 or more it moves on
to the next byte(s).
Return Values
true if the bit is set and false otherwise.
Description
Returns the value of the specified bit as a boolean.
Examples
! me = MemoryContainer.Create( 100 )
| print( MemoryContainer.GetBit( me, 5, 0 ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetBits
Brief
Returns the value inside the specified bit range as a number.
Definition
number MemoryContainer.GetBits( MemoryContainer container, number bytelndex, number bitlndex, number
bitCount )
Arguments
container - The instance of the memory container.bytelndex - The byte index to start from.bitlndex - The bit index, starts at 0 and if it is 8 or more
it moves on to the next byte(s).bitCount - The number of bits to get. The maxium is 23 due to it mapping to the mantissa of the number.
Return Values
The number contained within the bit range.
Description
Returns the number contained within the bit range. It can cross byte boundaries.
Examples
! me = MemoryContainer.Create( 100 )
i MemoryContainer.SetInt8( me, 255 ) )
print( MemoryContainer.GetBits( me, 5, 1, 3 ) ) � Get bits 1-4 inclusive from byte 5
See Also
� MemoryContainer.Create
� MemoryContainer.SetBits
� MemoryContainer.SetBit
� MemoryContainer.GetBit
MemoryContainer.GetFloatl 6
Brief
Returns the value of the specified 16-bit float as a number.
Definition
number Memory-Container.GetFloatl6 ( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.
Return Values
A number converted from a 16-bit float.
Description
Returns the value of the specified float as a number.
Examples
: me = MemoryContainer.Create( 100 )
; print( MemoryContainer.GetFloatl6( me, 2 ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetFloat32
Brief
Returns the value of the specified float as a number.
Definition
number MemoryContainer.GetFloat32( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.
Return Values
A number which matches the format of a float.
Description
Returns the value of the specified float as a number.
Examples
! me = MemoryContainer.Create( 100 )
i print( MemoryContainer.GetFloat32( me, 8 ) )
See Also
MemoryContainer.Create
MemoryContainer.Getlnt8
Brief
Returns the value of the specified byte as a number.
Definition
! number Memory-Container. GetInt8 ( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.
Return Values
A number ranging from -128 to 127.
Description
Returns the value of the specified byte as a number.
Examples
me = MemoryContainer.Create( 100 )
; print( MemoryContainer.GetInt8( me, 5 ) )
See Also
� MemoryContainer.Create
MemoryContainer.Getlntl 6
Brief
Returns the value of the specified word as a number.
Definition
! number MemoryContainer.GetInt16( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.
Return Values
A number ranging from -32768 to 32767.
Description
Returns the value of the specified word as a number.
Examples
me = MemoryContainer.Create ( 100 )
print( MemoryContainer.GetInti6( me, 5 ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetSize
Brief
Returns the size of the memory container in bytes.
Definition
! number Memory-Container. GetSize ( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The size of the memory container in bytes.
Description
Returns the size of the memory container in bytes.
Examples
! me = MemoryContainer.Create( 1024 )
| print( MemoryContainer.GetSize( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetString
Brief
Returns a string at the specified starting position.
Definition
! string MemoryContainer.GetString( MemoryContainer container, number bytelndex, number maxSize = nil )
Arguments
container - The instance of the memory container.bytelndex - The byte index to the beginning of the string.maxSize - The maximum size in bytes
of the string not including the null terminator. If not specified then it stops at the first null terminator or the end of the container.
Return Values
The string created from the memory container.
Description
Returns a string at the specified starting position until it either encounters a null terminator, reaches the specified maximum size or reaches the
end of the memory container.
Examples
me = Memory-Container.Create ( 100 )
MemoryContainer.Setstring( me, 0, "hello world." )
print( MemoryContainer.GetString( me, 0 ) )
See Also
� MemoryContainer.SetString
MemoryContainer.GetUlnt8
Brief
Returns the unsigned value of the specified byte as a number.
Definition
! number MemoryContainer.GetUInt8( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index.
Return Values
A number ranging from 0 to 255.
Description
Returns the value of the specified byte as an unsigned number.
Examples
! me = MemoryContainer.Create( 100 )
; print( MemoryContainer.GetUInt8( me, 5 ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetUIntl 6
Brief
Returns the value of the specified word as an unsigned number.
Definition
! number MemoryContainer.GetUInt16( MemoryContainer container, number bytelndex )
Arguments
container - The instance of the memory container.bytelndex - The byte index
Return Values
An unsigned number ranging from 0 to 65535.
Description
Returns the value of the specified word as an unsigned number.
Examples
! me = MemoryContainer.Create( 100 )
i print( MemoryContainer.GetUIntl6( me, 5 ) )
See Also
� MemoryContainer.Create
MemoryContainer.GetUsedSize
Brief
Returns the current number of bytes written to the container.
Definition
; MemoryContainer.GetUsedSize( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
number - The number of bytes written to the container.
Description
Returns the number of bytes written to the container using the ReadXQ/WriteXQ functions. The SetXQ functions have no affect on this value.
Examples
! me = MemoryContainer.Create( 100 )
| used = MemoryContainer.GetUsedSize( me )
See Also
� MemoryContainer.SetUsedSize
� MemoryContainer.Tell
� MemoryContainer.Seek
MemoryContainer.MemCopy
Brief
Copy memory from one memory container to another.
Definition
MemoryContainer.MemCopy(Memory-Container dest, number destOffset, MemoryContainer src, number
srcOffset, number bytes)
Arguments
dest - Destination memory container.destOffset - Offset into destination memory container at which to start writing.src - Source memory
container.srcOffset - Offset into source memory container at which to start reading.bytes - Number of bytes to copy.
Return Values
None.
Description
Copy memory from source memory container into destination memory container, starting at respective offsets. Note that large memory copies
should be avoided as this could affect the TRC compliance of your script with respect to execution time. If a large copy is required and is not
required to complete in the current frame, please see AsyncCommands.StreamCopy.
Examples
local myResource = Resource.Find("data")
local resData = MemoryContainer.Create(myResource)
local mem = MemoryContainer.Create(resData:GetSize())
MemoryContainer.MemCopy(mem, 0, resData, 0, resData:GetSize())
See Also
� MemoryContainer.MemSet
MemoryContainer. MemSet
Brief
Set a number of bytes of a memory container to a specific value.
Definition
MemoryContainer.MemSet(MemoryContainer mem, number offset, number value, number count = nil)
Arguments
mem - Memory container to modify.offset - Offset into memory container at which to start writing.value - Unsigned byte value (0 - 255) to
write.count - Number of bytes to set, or nil to set from offset to end of container.
Return Values
None.
Description
Sets a number of bytes in a memory container to a specific byte value. Note that large memory sets should be avoided as this could affect the
TRC compliance of your script with respect to execution time.
Examples
local mem = MemoryContainer.Create(1024)
; memiMemSet(0, Oxff)
See Also
� MemoryContainer.MemCopy
MemoryContainer.ReadBiglnt
Brief
Sets the value of the specified Biglnt from the memory container.
Definition
! MemoryContainer.ReadBiglnt( MemoryContainer container, Biglnt biglnt )
Arguments
container - The instance of the memory container.biglnt - The Biglnt to store the value.
Return Values
None.
Description
Sets the value of the specified Biglnt from the memory container. If there is insufficient space in the memory container to read the Biglnt, an error
will result. For example, if the container is 4 bytes from the end and you try to set a 64-bit Biglnt, this function will error.
Examples
I i = Biglnt.Create(64)
; MemoryContainer.ReadBiglnt( me, i )
See Also
� MemoryContainer.Create
� Biglnt.Create
� MemoryContainer.SetBiglnt
� MemoryContainer.WriteBiglnt
MemoryContainer.ReadFloatl 6
Brief
Returns the value of the floatl 6 at the read position float as a number.
Definition
! number MemoryContainer.ReadFloatl6( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the next floatl6 in the container.
Description
Returns the value of the floatl 6 at the read position float as a number. The read position is then advanced two bytes.
Examples
! me = MemoryContainer.Create( 100 )
i print( MemoryContainer.ReadFloatl6( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.ReadFloat32
Brief
Returns the value of the float32 at the read position float as a number.
Definition
number MemoryContainer.ReadFloat32( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the next float32 in the container.
Description
Returns the value of the float32 at the read position float as a number. The read position is then advanced four bytes.
Examples
me = MemoryContainer.Create( 100 )
i print( MemoryContainer.ReadFloat32( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.Readlnt8
Brief
Returns the value of the byte at the read position float as a number.
Definition
number MemoryContainer.Readlnt8( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the next byte in the container.
Description
Returns the value of the byte at the read position float as a number. The read position is then advanced one byte.
Examples
! me = MemoryContainer.Create( 100 )
; print( MemoryContainer.Readlnt8( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.Readlntl 6
Brief
Returns the value of the inti 6 at the read position float as a number.
Definition
number MemoryContainer.Readlnt16( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the next inti 6 in the container.
Description
Returns the value of the inti 6 at the read position float as a number. The read position is then advanced two bytes.
Examples
! me = MemoryContainer.Create( 100 )
! print( MemoryContainer.Readlnt16( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.ReadString
Brief
Returns the value of the string at the read position.
Definition
number Memory-Container. Readstring ( MemoryContainer container, readSize = 0 )
Arguments
container - The instance of the memory container.
Return Values
The value of the next string in the container.
Description
Reads a string from the memory container. If readSize is not specified or is zero, then the read size size is determined by searching for the
terminating 0. If readSize is set, then readSize number of bytes will always be read and the string will never excede that size.
Examples
! me = MemoryContainer.Create( 100 )
| print( MemoryContainer.Readstring( me ) )
See Also
� MemoryContainer.Create
MemoryContainer.ReadUlnt8
Brief
Returns the value of the byte at the read position as an unsigned number.
Definition
number MemoryContainer.ReadUInt8( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the 8-bit unsigned integer in the container.
Description
Returns the value of the 8-bit unsingned integer at the read position as a number. The read position is then advanced one byte.
Examples
! me = MemoryContainer.Create( 100 )
; print( MemoryContainer.ReadUInt8( me ) )
See Also
MemoryContainer.Create
MemoryContainer.Readlllntl 6
Brief
Returns the value of the uintl 6 at the current read position as a number.
Definition
! number Memory-Container . ReadUIntl 6 ( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
The value of the next uintl 6 in the container.
Description
Returns the value of the uintl 6 at the current read position as a number. The read position is then advanced two bytes.
Examples
me = MemoryContainer.Create( 100 )
; print( MemoryContainer.ReadUIntl6( me ) )
See Also
� MemoryContainer.Create
� MemoryContainer.Readlnt16
MemoryContainer.Reset
Brief
Resets a memory container.
Definition
! MemoryContainer.Reset( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
None.
Description
Resets a memory container so that it is empty again. It will be in the same state as when it was created.
Examples
MemoryContainer.Reset( container )
See Also
� MemoryContainer.Create
MemoryContainer.Seek
Brief
Move the read/write position within the container.
Definition
MemoryContainer.Seek( MemoryContainer container, number position )
Arguments
container - The instance of the memory container.position - The new position to seek to.
Return Values
boolean - True on success.
Description
Move the read/write position within the container. This has no affect on the used size of the memory container and you can only seek within the
used area of the container.
Examples
! me = MemoryContainer.Create( 100 )
i MemoryContainer.SetUsedSize( me, 50 )
> MemoryContainer.Seek( me, 50 )
See Also
� MemoryContainer.GetUsedSize
� MemoryContainer.Tell
� MemoryContainer.Seek
MemoryContainer.SetBiglnt
Brief
Stores the value of the specified Biglnt into the memory container at the given byte index.
Definition
! number MemoryContainer.SetBiglnt( MemoryContainer container, number bytelndex, Biglnt value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.value - The Biglnt value to set into the memory container
Return Values
Returns the next byte index after the value in the Biglnt is written.
Description
If there is insufficient space in the memory container to store the Biglnt, an error will result. For example, if the byte offset is 4 bytes from the end
of the container and you try to set a 64-bit Biglnt, this function will error.
Examples
me = MemoryContainer.Create ( 100 )
i = Biglnt.Create (64, 329823)
MemoryContainer.SetBiglnt( me, 8, i )
See Also
� MemoryContainer.Create
� Biglnt.Create
� MemoryContainer.WriteBiglnt
MemoryContainer.SetBit
Brief
Sets the value of the specified bit.
Definition
MemoryContainer.SetBit( MemoryContainer container, number bytelndex, number bitlndex, boolean value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.bitlndex - The bit index, starts at 0 and if it is 8 or more it moves on
to the next byte(s).value - The value to set the bit to.
Return Values
The next bit index along, can be greater than 7.
Description
Sets the value of the specified bit. if using the return value of this function and want to round it up to the next byte then do something similar to
this example:
bit Array =
Unknown macro: {true, false, true, false, false, true, false, true, false, false, true, true}
me = MemoryContainer.Create( 100 )
bytelndex = 23
bitlndex = 3
for index = 1, #bitArray do
bitlndex = MemoryContainer.SetBit( me, bytelndex, bitlndex, bitArray[ index ])
end
bytelndex = math.floor( bytelndex + ( bitlndex + 7 ) / 8 )
MemoryContainer.Setlnt8( me, bytelndex, 255 ))
Examples
me = Memory-Container.Create ( 100 )
MemoryContainer.SetBit( me, 5, 1, true ) )
See Also
� MemoryContainer.Create
MemoryContainer.SetBits
Brief
Sets the specified range of bits to the specified value.
Definition
MemoryContainer.SetBits( MemoryContainer container, number bytelndex, number bitlndex, number
bitCount, number value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.bitlndex - The bit index, starts at 0 and if it is 8 or more it moves on
to the next byte(s).bitCount - The number of bits to set. Ranges from 1 to 23.value - The value to pack into the bits.
Return Values
The next bit index along, can be greater than 7.
Description
Sets the values of the specified bits.
Examples
! me = MemoryContainer.Create( 100 )
; MemoryContainer.SetBits( me, 5, 1, 4, 5 ) ) � 3 bits can store values from 0 to 7.
See Also
� MemoryContainer.Create
� MemoryContainer.GetBits
� MemoryContainer.SetBit
� MemoryContainer.GetBit
MemoryContainer.SetFloatl 6
Brief
Stores the value of the specified number starting from the byte index into a Floatl 6.
Definition
MemoryContainer.SetFloatl6( MemoryContainer container, number bytelndex, number|number[] value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.value - The value to set the 16-bit float to or if a table is supplied it
sets all the values in the table starting from the byte index.
Return Values
Returns the next byte index after this value is written.
Description
Compresses the value of the specified to a Float16 starting from the byte index. The Float16 does not map directly to a number in lua. It is 2 bytes
in size and the bits are distributed as:
bits 0 - 9 : Mantissa
bits 10 -14 : Exponent
bit 15 : Sign
The range of the 16-bit float is between -131008 and 131008. Values out of this range are clamped to it.
Examples
me = MemoryContainer.Create ( 100 )
MemoryContainer.SetFloat16( me, 5, 123.12 )
See Also
� MemoryContainer.Create
MemoryContainer.SetFloat32
Brief
Sets the value of the specified Float32 starting from the byte index.
Definition
MemoryContainer.SetFloat32( MemoryContainer container, number bytelndex, number|number[] value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.value - The value to set in the memory container or if a table is
supplied it sets all the values in the table starting from the byte index.
Return Values
Returns the next byte index after this value is written.
Description
Sets the value of the specified Float32 starting from the byte index. The Float32 maps directly to a number in lua. It is 4 bytes in size and the bits
are distributed as:
bits 0 - 22 : Mantissa
bits 23 - 30 : Exponent
bit 31 : Sign
Examples
me = MemoryContainer.Create( 100 )
MemoryContainer.SetFloat32( me, 5, 123.12 )
See Also
MemoryContainer.Create
MemoryContainer.Setlnt8
Brief
Sets the value of the specified byte.
Definition
MemoryContainer.SetInt8( MemoryContainer container, number bytelndex, number|number[] value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.value - The value to set in the memory container or if a table is
supplied it sets all the values in the table starting from the byte index.
Return Values
Returns the next byte index after this value is written.
Description
Sets the value of the specified byte.
Examples
! me = MemoryContainer.Create( 100 )
i MemoryContainer.SetInt8( me, 5, 123 )
See Also
� MemoryContainer.Create
MemoryContainer.Setlntl 6
Brief
Sets the value of the specified word starting from the byte index.
Definition
MemoryContainer.Setlntl6( MemoryContainer container, number bytelndex, number|number[] value )
Arguments
container - The instance of the memory container.bytelndex - The byte index.value - The value to set in the memory container or if a table is
supplied it sets all the values in the table starting from the byte index.
Return Values
Returns the next byte index after this value is written.
Description
Sets the value of the specified word starting from the byte index.
Examples
me = Memory-Container.Create ( 100 )
MemoryContainer.Setlntl6( me, 5, 12322 )
See Also
� MemoryContainer.Create
MemoryContainer.SetString
Brief
Stores a string in the memory container at the specified starting position.
Definition
MemoryContainer.Setstring( MemoryContainer container, number bytelndex, string value )
Arguments
container - The instance of the memory container.bytelndex - The byte index to the beginning of the string.value - The string to store.
Return Values
Returns the next byte index after the string and null terminator are written.
Description
Stores a string in the memory container at the specified starting position. The memory container needs enough avaiable space to store the string
and a null terminator. If there is not enough space the memory container generates an error.
Examples
! me = MemoryContainer.Create( 100 )
! MemoryContainer.Setstring( me, 0, "hello world." )
| print( MemoryContainer.GetString( me, 0 ) )
See Also
� MemoryContainer.GetString
MemoryContainer.SetUsedSize
Brief
Sets the used size in bytes in the memory container.
Definition
MemoryContainer.GetUsedSize( MemoryContainer container, number usedSize )
Arguments
container - The instance of the memory container.usedSize - The number of bytes to set the used size of the container.
Return Values
Description
Sets the used size in bytes in the memory container so you can set the used size and within it and then use the ReadX()/WriteX() functions. The
SetX() functions have no affect on this value.
Examples
me = MemoryContainer.Create( 100 )
MemoryContainer.SetInt8( 0, 1 )
MemoryContainer.SetUsedSize( 1 )
MemoryContainer.Writelnt8( 2 )
used = MemoryContainer.SetUsedSize( 50 )
See Also
� MemoryContainer.GetUsedSize
� MemoryContainer.Tell
� MemoryContainer.Seek
MemoryContainer.Tell
Brief
Returns the current read/write position within the container.
Definition
j MemoryContainer.Tell( MemoryContainer container )
Arguments
container - The instance of the memory container.
Return Values
number - The current read/write position in the container.
Description
Returns the current read/write position within the container.
Examples
me = MemoryContainer.Create( 100 )
i pos = MemoryContainer.Tell( me )
See Also
� MemoryContainer.GetUsedSize
� MemoryContainer.SetUsedSize
� MemoryContainer.Seek
MemoryContainer.WriteBiglnt
Brief
Writes the value of the specified Biglnt into the memory container.
Definition
! number MemoryContainer.WriteBiglnt( MemoryContainer container, Biglnt value )
Arguments
container - The instance of the memory container.value - The Biglnt value to set into the memory container
Return Values
None.
Description
If there is insufficient space in the memory container to store the Biglnt, an error will result. For example, if the container is 4 bytes from the end
and you try to set a 64-bit Biglnt, this function will error.
Examples
! me = MemoryContainer.Create( 100 )
! i = Biglnt.Create (64, 329823)
| MemoryContainer.WriteBiglnt( me, i )
See Also
� MemoryContainer.Create
� Biglnt.Create
� MemoryContainer.SetBiglnt
MemoryContainer. WriteFloatl 6
Brief
Writes an floatl 6 to a memory container.
Definition
! MemoryContainer.WriteFloatl6( MemoryContainer container, number|number[] value )
Arguments
container - The instance of the memory container.value - The value to write to the memory container or if a table then an array of values to write.
Return Values
None.
Description
Writes a floatl 6 to a memory container and advances the write position.
Examples
me = Memory-Container.Create ( 100 )
MemoryContainer.WriteFloat16( me, 123.4 )
See Also
� MemoryContainer.Create
MemoryContainer.WriteFloat32
Brief
Writes a float32 to a memory container.
Definition
MemoryContainer.WriteFloat32( MemoryContainer container, number|number[] value )
Arguments
container - The instance of the memory container.value - The value to write to the memory container or if a table then an array of values to write.
Return Values
None.
Description
Writes a float32 to a memory container and advances the write position.
Examples
me = MemoryContainer.Create( 100 )
j MemoryContainer.WriteFloat32( me, 123.4 )
See Also
� MemoryContainer.Create
MemoryContainer.Writelnt8
Brief
Writes a byte to a memory container.
Definition
MemoryContainer.Writelnt8( MemoryContainer container, number|number[] value )
Arguments
container - The instance of the memory container.value - The value to write to the memory container or if a table then an array of values to write.
Return Values
None.
Description
Writes a byte to a memory container and advances the write position.
Examples
1 me = MemoryContainer.Create( 100 )
! MemoryContainer.Writelnt8( me, 123 )
See Also
� MemoryContainer.Create
MemoryContainer.Writelntl 6
Brief
Writes an inti 6 to a memory container.
Definition
MemoryContainer.Writelntl6( MemoryContainer container, number|number[] value )
Arguments
container - The instance of the memory container.value - The value to write to the memory container or if a table then an array of values to write.
Return Values
None.
Description
Writes an inti 6 to a memory container and advances the write position.
Examples
! me = MemoryContainer.Create( 100 )
i MemoryContainer.Writelntl6( me, 123 )
See Also
� MemoryContainer.Create
MemoryContainer.WriteString
Brief
Writes a string to a memory container.
Definition
MemoryContainer.WriteString( MemoryContainer container, string value, number writeSize = 0 )
Arguments
container - The instance of the memory container.value - The value to write.writeSize - The number of bytes to write to the memory container
Return Values
None.
Description
Writes a string to a memory container and advances the write position. If the writeSize is specified, then writeSize number of bytes will always be
written to the container.
Examples
me = Memory-Container.Create ( 100 )
j MemoryContainer.WriteString( me, "Hello World!" )
See Also
� MemoryContainer.Create