In order to send anything from FB to the lua state, or from the lua state to FB, you need to pass it through the lua stack, that's what this is for in the function: (byval L as lua_State ptr)
On the lua side, if you use a function like this:
sPrint(x,y, text ,color)
each argument is put into the stack, and can be accessed from the FB side by pointing to the position in the stack. For instance:
lua_tonumber(L, 2) -- gets the y position
On the FB side, to return some data to the lua side, you need to push it onto the stack:
function ikey cdecl (byval L as lua_State ptr)
lua_pushstring( L, inkey$) -- pushes the result of inkey$ onto the stack
ikey = 1 -- tells lua that one item was pushed into the stack
end function
In order to be able to use an image made with imagecreate, I need to figure out how to send the image pointer through the stack
** I just looked in lua.bi, ther is a function to get a pointer - lua_topointer, but not one to push it