Page 1 of 1

How can I interact with LOVE2D objects in C code?

Posted: Thu Sep 13, 2018 11:53 pm
by NetherGranite
Let's say I have the following Lua code:

Code: Select all

local imageData = love.image.newImageData(100, 100)

someLibrary.doSomethingTo(imageData)
and let's say that doSomethingTo() is defined by

Code: Select all

void doSomethingDo(lua_State *L) {
    u_int8 * data = // code here
}
What code needs to go at "// code here" so that the variable "data" will now hold the array of data of the ImageData?

I was able to find this code in LOVE2D's source if it helps at all:

Code: Select all

void *ImageData::getData() const
{
    return data;
}