[id] = AllocMemFromPointer(id, ptr, size)
#LIGHTUSERDATA
into a
memory block that you can read from and write to using the memory block
functions. The new memory block object will be made available under the handle
id
, or, if you specify Nil as id
, AllocMemFromPointer()
automatically chooses an identifier and returns it.
Note that AllocMemFromPointer()
will not make a local copy of the memory
pointed to by parameter 2. It will just allocate a container object
so that you can access the memory data using the memory block functions. The
size
argument is only used to prevent read or write operations that are
outside the memory block's boundaries. If you don't know the size of the
memory block, you can also pass 0 in the size
argument. In that case,
Hollywood will never forbid any read and write operation on this memory
block object.
Be warned that this is a dangerous function and should only be used by people who know what they are doing. Reading from or writing to non-allocated memory can easily crash your program.
#LIGHTUSERDATA
variable pointing to a memory block