I am trying to smuggle a memory address into a lua thread, but I can't figure out how to.
I thought maybe I could use love.data but things aren't panning out.
I just want to be able to access the same memory I use in the main thread in a seperate thread.
local threadCode = [[
-- Receive values sent via thread:start
local bytedata = ...
local ffi = require("ffi")
ffi.cdef(" typedef long map[10000000]; void* malloc(size_t); void free(void*);")
local map = ffi.cast("map(&)", bytedata)
print("THREAD", map[7]) -- Should equal 44
]]
The issue is with your thread code, you don't grab the FFI Pointer of the byteData in order to correctly cast it