diff --git a/src/common/wrap_Data.cpp b/src/common/wrap_Data.cpp index 7415cdaf8..06e0b6891 100644 --- a/src/common/wrap_Data.cpp +++ b/src/common/wrap_Data.cpp @@ -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 } }; diff --git a/src/common/wrap_Data.h b/src/common/wrap_Data.h index c11285487..84faf41b1 100644 --- a/src/common/wrap_Data.h +++ b/src/common/wrap_Data.h @@ -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); diff --git a/src/modules/filesystem/physfs/wrap_FileData.cpp b/src/modules/filesystem/physfs/wrap_FileData.cpp index 9f04a991c..9512e32bd 100644 --- a/src/modules/filesystem/physfs/wrap_FileData.cpp +++ b/src/modules/filesystem/physfs/wrap_FileData.cpp @@ -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 }, diff --git a/src/modules/font/wrap_GlyphData.cpp b/src/modules/font/wrap_GlyphData.cpp index 55bf4c767..9d4569f84 100644 --- a/src/modules/font/wrap_GlyphData.cpp +++ b/src/modules/font/wrap_GlyphData.cpp @@ -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 }, diff --git a/src/modules/image/wrap_CompressedData.cpp b/src/modules/image/wrap_CompressedData.cpp index 8a37e1049..64764a6f0 100644 --- a/src/modules/image/wrap_CompressedData.cpp +++ b/src/modules/image/wrap_CompressedData.cpp @@ -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 }, diff --git a/src/modules/image/wrap_ImageData.cpp b/src/modules/image/wrap_ImageData.cpp index 2d74bb1c7..be9efe621 100644 --- a/src/modules/image/wrap_ImageData.cpp +++ b/src/modules/image/wrap_ImageData.cpp @@ -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 }, diff --git a/src/modules/sound/wrap_SoundData.cpp b/src/modules/sound/wrap_SoundData.cpp index cf2132a44..359b02b8f 100644 --- a/src/modules/sound/wrap_SoundData.cpp +++ b/src/modules/sound/wrap_SoundData.cpp @@ -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 },