diff --git a/doc.lua b/doc.lua index 808ed50..87bb3f9 100644 --- a/doc.lua +++ b/doc.lua @@ -153,12 +153,15 @@ end]===], long = [===[ Register all love callbacks to call Gamestate.update(), Gamestate.draw(), etc. automatically. - This is by done the love callbacks, e.g.: - \[local _update = love.update + This is by done by overwriting the love callbacks, e.g.: + {## local old_update = love.update function love.update(dt) - _update(dt) + old_update(dt) Gamestate.current:update(dt) -end\]]===], +end} + +{!! Note:} Only works when called in {# love.load()} or any other function that is executed +after the whole file is loaded.]===], params = {}, returns = {}, example = [===[ diff --git a/index.html b/index.html index 600665a..0d8581c 100755 --- a/index.html +++ b/index.html @@ -136,12 +136,13 @@ end function love.keypressed(key, code) Gamestate.keypressed(key, code) -end

function registerEvents()^ top

Register all love callbacks to call Gamestate.update(), Gamestate.draw(), etc. automatically.

This is by done the love callbacks, e.g.: - \[local _update = love.update +end

function registerEvents()^ top

Register all love callbacks to call Gamestate.update(), Gamestate.draw(), etc. automatically.

This is by done by overwriting the love callbacks, e.g.: +

local old_update = love.update
 function love.update(dt)
-    _update(dt)
+    old_update(dt)
     Gamestate.current:update(dt)
-end\]

Parameters:
None.
Returns:
Nothing.
Example:
function love.load()
+end

Note: Only works when called in love.load() or any other function that is executed +after the whole file is loaded.

Parameters:
None.
Returns:
Nothing.
Example:
function love.load()
     Gamestate.registerEvents()
     Gamestate.switch(menu)
 end