mirror of
https://github.com/love2d/love.git
synced 2026-08-13 09:00:54 +02:00
Re-added Data:getPointer (can be used with LuaJIT's FFI)
This commit is contained in:
@@ -35,6 +35,13 @@ int w_Data_getString(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Data_getPointer(lua_State *L)
|
||||
{
|
||||
Data *t = luax_checkdata(L, 1);
|
||||
lua_pushlightuserdata(L, t->getData());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Data_getSize(lua_State *L)
|
||||
{
|
||||
Data *t = luax_checkdata(L, 1);
|
||||
@@ -45,6 +52,7 @@ int w_Data_getSize(lua_State *L)
|
||||
const luaL_Reg w_Data_functions[] =
|
||||
{
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace love
|
||||
|
||||
Data *luax_checkdata(lua_State *L, int idx);
|
||||
int w_Data_getString(lua_State *L);
|
||||
int w_Data_getPointer(lua_State *L);
|
||||
int w_Data_getSize(lua_State *L);
|
||||
int w_Data_open(lua_State *L);
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ static const luaL_Reg w_FileData_functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getFilename", w_FileData_getFilename },
|
||||
|
||||
@@ -125,6 +125,7 @@ static const luaL_Reg functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getWidth", w_GlyphData_getWidth },
|
||||
|
||||
@@ -110,6 +110,7 @@ static const luaL_Reg functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getWidth", w_CompressedData_getWidth },
|
||||
|
||||
@@ -296,6 +296,7 @@ static const luaL_Reg functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getWidth", w_ImageData_getWidth },
|
||||
|
||||
@@ -102,6 +102,7 @@ static const luaL_Reg functions[] =
|
||||
{
|
||||
// Data
|
||||
{ "getString", w_Data_getString },
|
||||
{ "getPointer", w_Data_getPointer },
|
||||
{ "getSize", w_Data_getSize },
|
||||
|
||||
{ "getChannels", w_SoundData_getChannels },
|
||||
|
||||
Reference in New Issue
Block a user