-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.lua
More file actions
42 lines (31 loc) · 732 Bytes
/
Copy pathapp.lua
File metadata and controls
42 lines (31 loc) · 732 Bytes
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
local lapis = require("lapis")
local app = lapis.Application()
app:enable("etlua") -- enable html templates
-- layout template
app.layout = require "views.layout"
-- index
app:get("/", function(self)
-- get list of games in games/
self.games = {}
function Game(game)
if game.title then
table.insert(self.games, game.title)
end
end
dofile("game_funcs.lua")
dofile("games.lua")
return {render = "index"} -- views/index.etlua
end)
app:match("/:game", function(self)
self.game = {}
self.game.title = "None"
function Game(game)
if game.title == self.params.game then
self.game = game
end
end
dofile("game_funcs.lua")
dofile("games.lua")
return {render = "game"} -- views/game.etlua
end)
return app