AllocMemFromPointer -- initialize memory block from pointer (V6.0)
[id] = AllocMemFromPointer(id, ptr, size)
This command can be used to convert a pointer of type #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 a vacant 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.

identifier for the memory block or Nil for auto id selection
#LIGHTUSERDATA variable pointing to a memory block
size of the memory block in bytes or 0 if you don't know the size
optional: identifier of the memory block; will only be returned when you pass Nil as argument 1 (see above)

Show TOC