diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-03-29 12:07:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-29 18:07:00 +0200 |
commit | 06d197cdd042392e1551e5e7244c61300a6bb4e3 (patch) | |
tree | c47a0c58917f5f89af1c5128e42611d0d8a3d320 /builtin | |
parent | 11aab4198be1a0f1104a433896e908e4c86de0c9 (diff) | |
download | minetest-06d197cdd042392e1551e5e7244c61300a6bb4e3.tar.gz minetest-06d197cdd042392e1551e5e7244c61300a6bb4e3.tar.bz2 minetest-06d197cdd042392e1551e5e7244c61300a6bb4e3.zip |
Store vector metatable in registry
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/common/tests/misc_helpers_spec.lua | 1 | ||||
-rw-r--r-- | builtin/common/tests/serialize_spec.lua | 1 | ||||
-rw-r--r-- | builtin/common/tests/vector_spec.lua | 2 | ||||
-rw-r--r-- | builtin/common/vector.lua | 6 | ||||
-rw-r--r-- | builtin/mainmenu/tests/serverlistmgr_spec.lua | 1 |
5 files changed, 6 insertions, 5 deletions
diff --git a/builtin/common/tests/misc_helpers_spec.lua b/builtin/common/tests/misc_helpers_spec.lua index b16987f0b..b11236860 100644 --- a/builtin/common/tests/misc_helpers_spec.lua +++ b/builtin/common/tests/misc_helpers_spec.lua @@ -1,4 +1,5 @@ _G.core = {} +_G.vector = {metatable = {}} dofile("builtin/common/vector.lua") dofile("builtin/common/misc_helpers.lua") diff --git a/builtin/common/tests/serialize_spec.lua b/builtin/common/tests/serialize_spec.lua index e46b7dcc5..69b2b567c 100644 --- a/builtin/common/tests/serialize_spec.lua +++ b/builtin/common/tests/serialize_spec.lua @@ -1,4 +1,5 @@ _G.core = {} +_G.vector = {metatable = {}} _G.setfenv = require 'busted.compatibility'.setfenv diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua index 2f72f3383..25880236b 100644 --- a/builtin/common/tests/vector_spec.lua +++ b/builtin/common/tests/vector_spec.lua @@ -1,4 +1,4 @@ -_G.vector = {} +_G.vector = {metatable = {}} dofile("builtin/common/vector.lua") describe("vector", function() diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index 581d014e0..90010f6de 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -6,10 +6,8 @@ Note: The vector.*-functions must be able to accept old vectors that had no meta -- localize functions local setmetatable = setmetatable -vector = {} - -local metatable = {} -vector.metatable = metatable +-- vector.metatable is set by C++. +local metatable = vector.metatable local xyz = {"x", "y", "z"} diff --git a/builtin/mainmenu/tests/serverlistmgr_spec.lua b/builtin/mainmenu/tests/serverlistmgr_spec.lua index a091959fb..ab7a6c60c 100644 --- a/builtin/mainmenu/tests/serverlistmgr_spec.lua +++ b/builtin/mainmenu/tests/serverlistmgr_spec.lua @@ -1,4 +1,5 @@ _G.core = {} +_G.vector = {metatable = {}} _G.unpack = table.unpack _G.serverlistmgr = {} |