Pointer:constructor([cobj])constructor

The Pointer constructor creates a new Pointer instance, that points to the memory address of the C value represented by the provided C object instance.

Parameters

[cobj]

A C object instance to point to, which can be any of the following :

Notes

  • Calling the constructor without any arguments will return a NULL C pointer.
  • Only Cvalues can be pointed to (C definition objects can't be used).

Return value

The constructor returns a new Pointer instance.

Example

--! luart-extensions import c -- Creates a C int Value local int = c.int(1250) -- Creates a Pointer to this int Value local c_ptr = c.Pointer(int) -- Prints the pointer print(c_ptr) -- Prints the pointer content print(c_ptr.content)