Add Data:getFFIPointer. Similar to Data:getPointer but returns a cdata pointer directly (or nil if the FFI isn't available).

It should be preferred instead of Data:getPointer because the latter uses lightuserdata which can't store more all possible memory addresses on some new arm64 architectures, when LuaJIT is used.
This commit is contained in:
Alex Szpakowski
2019-07-20 10:47:58 -03:00
parent d700800888
commit cb4b45dcf1
17 changed files with 170 additions and 64 deletions
+2 -12
View File
@@ -148,18 +148,8 @@ extern "C" int luaopen_sounddata(lua_State *L)
{
int ret = luax_register_type(L, &SoundData::type, data::w_Data_functions, w_SoundData_functions, nullptr);
luax_gettypemetatable(L, SoundData::type);
// Load and execute SoundData.lua, sending the metatable as an argument.
if (lua_istable(L, -1))
{
luaL_loadbuffer(L, sounddata_lua, sizeof(sounddata_lua), "SoundData.lua");
lua_pushvalue(L, -2);
lua_call(L, 1, 0);
}
// Pop the metatable.
lua_pop(L, 1);
love::data::luax_rundatawrapper(L, SoundData::type);
luax_runwrapper(L, sounddata_lua, sizeof(sounddata_lua), "SoundData.lua", SoundData::type, nullptr);
return ret;
}