From f8d86a78fccde29af807bb8a96dd8d31658da782 Mon Sep 17 00:00:00 2001 From: Engineer Smith <56016593+EngineerSmith@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:28:14 +0100 Subject: [PATCH] Made newDataView size optional --- src/modules/data/wrap_DataModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/data/wrap_DataModule.cpp b/src/modules/data/wrap_DataModule.cpp index b9feda515..6c60d8e79 100644 --- a/src/modules/data/wrap_DataModule.cpp +++ b/src/modules/data/wrap_DataModule.cpp @@ -57,7 +57,7 @@ int w_newDataView(lua_State *L) Data *data = luax_checkdata(L, 1); lua_Integer offset = luaL_checkinteger(L, 2); - lua_Integer size = luaL_checkinteger(L, 3); + lua_Integer size = luaL_optinteger(L, 3, data->getSize() - offset); if (offset < 0 || size < 0) return luaL_error(L, "DataView offset and size must not be negative.");