-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathselectiveFunctionality.output.lua
57 lines (41 loc) · 1.42 KB
/
selectiveFunctionality.output.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--[[============================================================
--=
--= LuaPreprocess example: Selective functionality.
--=
--= Here we decide what code should be included and run in the
--= final program with some flags set in the metaprogram.
--=
--============================================================]]
quitGame = false
function addNormalLevelsToArray(levels) print("Adding normal levels") end
function addTestLevelsToArray(levels) print("(*) Adding test levels") end
function getPlayableLevels()
local levels = {}
addNormalLevelsToArray(levels)
return levels
end
function loadAssets() print("Loading assets") end
function showLevelsToPlayer(levels) print("Showing levels to player") end
function readInput() print("Reading input") end
function updateGameState() print("Updating game state") end
function render() print("Rendering") end
function initConsole() print("(*) Initting console") end
function updateConsole() print("(*) Updating console") end
function runGame()
print("Starting game")
loadAssets()
initConsole()
local levels = getPlayableLevels()
showLevelsToPlayer(levels)
-- Main game loop.
repeat
readInput()
updateConsole()
updateGameState()
render()
-- In this example, don't run the loop forever!
quitGame = true
until quitGame
print("Quitting game")
end
runGame()