Conversion between love objects and FFI structures

This page leads to conversion between löve objects and FFI (Foreign Function Interface) structures.

Love objects in lua are always stored in a userdata object (Proxy) that contains the object itself and a type identifier.

  • Check the line 99 to see the structure of the Proxy object

Functions

cdata Object, number Type, string TypeName = love.ffi(Object Object)
Description: This function converts a love object into a FFI cdata object. It returns the object itself (not the Proxy object), it's type and type name.

Object Object = love.fromffi(cdata Object, number Type, string TypeName)
Description: This function converts a FFI cdata object into a Proxy userdata object, it is required to give the type name to assign the metatable to the userdata object, and the type id for the Proxy object.