gotten_light being a table causing crash

I was getting a crash because gotten_light was a table, and it tried to compare with a number. This could be because of my new code, but I'm not sure.
This commit is contained in:
GuyLiner 2023-02-08 13:27:36 -05:00 committed by Gitea
parent 9faa747009
commit 44c452bf25
1 changed files with 7 additions and 2 deletions

View File

@ -532,8 +532,13 @@ local function spawn_check(pos,spawn_def,ignore_caps)
and not is_bedrock then
--only need to poll for node light if everything else worked
local gotten_light = get_node_light(pos)
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
return true
--gotten_light is a table sometimes, causing a crash. Don't know the cause.
print(gotten_light)
if type(gotten_light) ~= "table" then
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
return true
end
end
end
return false