Notes
- Calling the constructor without any arguments will return a
NULL
C pointer. - Only C values can be pointed to (C definition objects can't be used).
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 :
Example
local c = require "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)