diff --git a/games/devtest/.luacheckrc b/games/devtest/.luacheckrc index b6fa5b3691..c4cfc3178f 100644 --- a/games/devtest/.luacheckrc +++ b/games/devtest/.luacheckrc @@ -35,13 +35,20 @@ read_globals = { string = {fields = {"split", "trim"}}, table = {fields = {"copy", "getn", "indexof", "insert_all", "key_value_swap"}}, math = {fields = {"hypot", "round"}}, - - -- Busted-style unit testing - "describe", - "it", - assert = {fields = {"same", "equals"}}, } +-- Busted-style unit testing +local bustitute = { + read_globals = { + "describe", + "it", + assert = {fields = {"same", "equals"}}, + }, +} + +files["mods/unittests/matrix4.lua"] = bustitute +files["mods/unittests/rotation.lua"] = bustitute + globals = { "aborted", "minetest", diff --git a/games/devtest/mods/unittests/matrix4.lua b/games/devtest/mods/unittests/matrix4.lua index 3b9cef2704..25321bfebb 100644 --- a/games/devtest/mods/unittests/matrix4.lua +++ b/games/devtest/mods/unittests/matrix4.lua @@ -55,7 +55,7 @@ it("copy", function() end) it("unpack", function() - assert.equals(mat1, Matrix4.new(mat1:unpack())) + assert.equals(mat1, Matrix4.new(mat1:unpack())) end) describe("transform", function() diff --git a/src/script/lua_api/l_matrix4.cpp b/src/script/lua_api/l_matrix4.cpp index 60415df7f9..f13908e1fb 100644 --- a/src/script/lua_api/l_matrix4.cpp +++ b/src/script/lua_api/l_matrix4.cpp @@ -44,7 +44,7 @@ inline core::matrix4 &LuaMatrix4::create(lua_State *L) int LuaMatrix4::l_identity(lua_State *L) { - create(L) = core::IdentityMatrix; + create(L) = core::matrix4(); return 1; } @@ -69,7 +69,7 @@ int LuaMatrix4::l_translation(lua_State *L) { v3f translation = readParam(L, 1); core::matrix4 &matrix = create(L); - matrix = core::IdentityMatrix; + matrix = core::matrix4(); matrix.setTranslation(translation); return 1; } @@ -86,7 +86,7 @@ int LuaMatrix4::l_scale(lua_State *L) { v3f scale = readParam(L, 1); core::matrix4 &matrix = create(L); - matrix = core::IdentityMatrix; + matrix = core::matrix4(); matrix.setScale(scale); return 1; } @@ -96,7 +96,7 @@ int LuaMatrix4::l_reflection(lua_State *L) v3f normal = readParam(L, 1); normal.normalize(); core::matrix4 &matrix = create(L); - matrix = core::IdentityMatrix; + matrix = core::matrix4(); // TODO move to CMatrix4 f32 factor = 2.0f / normal.getLengthSQ(); auto subtract_scaled_row = [&](int i, f32 scalar) {