【发布时间】:2017-06-03 20:37:06
【问题描述】:
我想将存储字符串的 Lua 表传递给 c 函数。例如,如果我有
tStr = {"String1", "String2", "String3"}
如何传递给 C 函数。我想我必须打电话给 ffi.new 但我不确定是哪种类型..
local cVar = ffi.new("??" , tStr) -- I am not sure what to pass as type
参数
同样在 C 函数中,我不确定如何访问整个数据,它会是指向 string 的字符串指针,**str 吗??
void cFunction(**str); --What pointer type should be used here ??
... 如果我错过了一些明显的问题,我深表歉意。但我只是从 Lua 和 ffi 开始。所以我仍然不知道大多数事情..
【问题讨论】: