Skip to content

Commit 429601c

Browse files
committed
Allow passing of multiple parameters to a new screen
When the screenmanager switches to a new screen or pushes a new screen on the stack it can pass multiple parameters to the init function of the new screen. Simply add as many variables as you need after the screen identifier: ScreenManager.switch('main', { foo = 1, bar = 2}, 'Baz')
1 parent a1bb262 commit 429601c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ScreenManager.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ end
6969
--
7070
-- @param nscreen
7171
--
72-
function ScreenManager.switch(screen)
72+
function ScreenManager.switch(screen, ...)
7373
clear();
74-
ScreenManager.push(screen);
74+
ScreenManager.push(screen, ...);
7575
end
7676

7777
---
@@ -81,7 +81,7 @@ end
8181
--
8282
-- @param screen - The name of the screen to push on the stack.
8383
--
84-
function ScreenManager.push(screen)
84+
function ScreenManager.push(screen, ...)
8585
-- Deactivate the previous screen if there is one.
8686
if ScreenManager.peek() then
8787
ScreenManager.peek():setActive(false);
@@ -100,7 +100,7 @@ function ScreenManager.push(screen)
100100
end
101101

102102
-- Create the new screen and initialise it.
103-
stack[#stack]:init();
103+
stack[#stack]:init(...);
104104
end
105105

106106
---

0 commit comments

Comments
 (0)