From f60ad2a7121f2ced266b06f762a96db6e138e5af Mon Sep 17 00:00:00 2001
From: DBotThePony <dbotthepony@yandex.ru>
Date: Wed, 1 Jan 2025 09:42:56 +0700
Subject: [PATCH] Fix entity query bindings not making copy of tables they are
 modifying

---
 src/main/resources/scripts/world.lua | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/scripts/world.lua b/src/main/resources/scripts/world.lua
index 0accd486..f3af6284 100644
--- a/src/main/resources/scripts/world.lua
+++ b/src/main/resources/scripts/world.lua
@@ -90,6 +90,8 @@ local entityTypes = {
 
 local function entityTypeNamesToIntegers(input, fullName)
 	if input then
+		local output = {}
+
 		for i, v in ipairs(input) do
 			-- could have used string.lower, but original engine does case-sensitive comparison here
 			-- so we can save quite a lot cpu cycles for ourselves by not doing string.lower
@@ -99,10 +101,10 @@ local function entityTypeNamesToIntegers(input, fullName)
 				error('invalid entity type ' .. tostring(v) .. ' for ' .. fullName .. ' in types table at index ' .. i, 3)
 			end
 
-			input[i] = lookup
+			output[i] = lookup
 		end
 
-		return input
+		return output
 	end
 end