GetNumDungeonMapLevels() now - contrary to its name! - returns not the total number, but a list of valid floor numbers on the current map.
lua Code:
local dungeonLevels = { GetNumDungeonMapLevels() };
for id, floorNum in ipairs(dungeonLevels) do
...
end