1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-28 09:39:31 +00:00

Custom dofile

This commit is contained in:
Étienne Fildadut 2017-09-02 19:47:06 +02:00
parent c7e72a0295
commit 5961b217c5

View file

@ -45,6 +45,10 @@ scene = {
-- @impl ubiquitousse -- @impl ubiquitousse
prefix = "", prefix = "",
--- Function which load a scene file
-- @impl ubiquitousse
dofile = dofile,
--- Creates and returns a new Scene object. --- Creates and returns a new Scene object.
-- @tparam[opt="unamed"] string name the new scene name -- @tparam[opt="unamed"] string name the new scene name
-- @impl ubiquitousse -- @impl ubiquitousse
@ -74,7 +78,7 @@ scene = {
-- @impl ubiquitousse -- @impl ubiquitousse
switch = function(scenePath, ...) switch = function(scenePath, ...)
local previous = scene.current local previous = scene.current
scene.current = dofile(getPath(scene.prefix..scenePath)) scene.current = scene.dofile(getPath(scene.prefix..scenePath))
scene.current.name = scenePath scene.current.name = scenePath
if previous then previous:exit() end if previous then previous:exit() end
scene.current:enter(...) scene.current:enter(...)
@ -90,7 +94,7 @@ scene = {
-- @impl ubiquitousse -- @impl ubiquitousse
push = function(scenePath, ...) push = function(scenePath, ...)
local previous = scene.current local previous = scene.current
scene.current = dofile(getPath(scene.prefix..scenePath)) scene.current = scene.dofile(getPath(scene.prefix..scenePath))
scene.current.name = scenePath scene.current.name = scenePath
if previous then previous:suspend() end if previous then previous:suspend() end
scene.current:enter(...) scene.current:enter(...)