It's not possible to pass a lua table to a C function

Hi

There is no function to get values from a lua table using the C_API, right now.
Is it planned in a future version of the SDK?
I try to do it myself by using <lua.h> but It produce identifier conflicts.

2 Likes

I'll +1 this one. It seems like you can get the type of argument as kTypeTable:

	enum LuaType (*getArgType)(int pos, const char** outClass);

but then you need to get a LuaUDObject:

	void* (*getArgObject)(int pos, char* type, LuaUDObject** outud);

and then???

yeah, ran into this as well

you can kind of work around it by pushing the values as stack arguments, but I measured the FFI cost to be pretty high in that case, so the computation on the C side would need to be quite significant to become a win.

I'm assuming the SDK is doing it for things like:

playdate.graphics.tilemap:setTiles()

so maybe there is a way to expose that in a future release?