mirror of
https://github.com/minetest-mods/areas.git
synced 2024-08-20 18:24:05 +02:00
The length of a table with non-sequential indexes in not defined
This commit is contained in:
parent
7df1bbc190
commit
f7f4c2ddb5
@ -30,11 +30,10 @@ end
|
|||||||
-- Finds the first usable index in a table
|
-- Finds the first usable index in a table
|
||||||
-- Eg: {[1]=false,[4]=true} -> 2
|
-- Eg: {[1]=false,[4]=true} -> 2
|
||||||
local function findFirstUnusedIndex(t)
|
local function findFirstUnusedIndex(t)
|
||||||
for i = 1, #t + 1 do
|
local i = 0
|
||||||
if t[i] == nil then
|
repeat i = i + 1
|
||||||
|
until t[i] == nil
|
||||||
return i
|
return i
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add a area, returning the new area's id.
|
-- Add a area, returning the new area's id.
|
||||||
|
Loading…
Reference in New Issue
Block a user