Hi, I'd like to request the JArray.eraseIndex() function be added to remove JArray entries. Currently, there's no way I can see to do this from within lua. table.remove() doesn't work since the JArray is cdata, not a table. I also had a look at JArray.__newindex using a nil value, but that doesn't seem to do the job.
So I had a look in the source code and came up with the following changes, which seem to work in my testing:
-- Added 'eraseIndex' function from tes_array.h to JArrayNativeFuncs in jc.lua.
local JArrayNativeFuncs = retrieveNativeFunctions('JArray',
{
object = {'handle'},
objectWithSize = {'handle', 'uint32_t'},
--getInt = {'int32_t', 'handle, index, int32_t'},
--getFlt = {'float', 'handle, index, float'},
--setInt = {'void', 'handle, index, int32_t'},
--setFlt = {'void', 'handle, index, float'},
valueType = {'int32_t', 'handle, index'}, -- AH CHANGED
eraseIndex = {'void', 'handle, index'}, -- AH ADDED
}
)
-- Added corresponding lua function to jc.lua
function JArray.eraseIndex(optr, idx)
JArrayNativeFuncs.eraseIndex(jc_context, optr.___id, convertIndex(idx))
end
Hi, I'd like to request the JArray.eraseIndex() function be added to remove JArray entries. Currently, there's no way I can see to do this from within lua. table.remove() doesn't work since the JArray is cdata, not a table. I also had a look at JArray.__newindex using a nil value, but that doesn't seem to do the job.
So I had a look in the source code and came up with the following changes, which seem to work in my testing:
Thanks.