Skip to content

Commit

Permalink
No longer cache game states
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Mar 18, 2013
1 parent cbef27b commit fa8b18c
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/vendor/gamestate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,20 @@ end

GS.Level = nil

function GS.load(name)

function GS.get(name)
if love.filesystem.exists("maps/" .. name .. ".lua") then
-- ugly hack to get around circular import
states[name] = GS.Level.new(name)
return GS.Level.new(name)
else
states[name] = require(name)
return require(name)
end

return states[name]
end

function GS.currentState()
return current
end


function GS.get(name)
local state = states[name]

if state then
return state
end

return GS.load(name)
end

function GS.switch(to, ...)
assert(to, "Missing argument: Gamestate to switch to")

Expand Down

0 comments on commit fa8b18c

Please sign in to comment.