require 'makegrid' -- Controls switching between levels ---@class LevelHandler ---@field levels string[] ---@field current integer LevelHandler = { levels = { 'test3', 'test2', 'test' }, current = 1, } -- Switches level to next or cycles if it was the last level ---@return Grid function LevelHandler:next() self.current = self.current + 1 if self.current > #self.levels then self.current = 1 end local levelPath = string.format('levels/%s', self.levels[self.current]) return MakeGrid( require( levelPath ) ) end -- Returns first level ---@return Grid function LevelHandler:first() local levelPath = string.format('levels/%s', self.levels[1]) return MakeGrid( require( levelPath ) ) end