Made newDataView size optional

This commit is contained in:
Engineer Smith
2024-07-29 20:28:14 +01:00
committed by GitHub
parent 9b362dbef9
commit f8d86a78fc
+1 -1
View File
@@ -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.");