Created
November 1, 2014 14:07
-
-
Save gazliddon/23087a9ea481b18f40cc to your computer and use it in GitHub Desktop.
Is This Bad Lua Form?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Creating a object and I have a load of action functions that all return self | |
-- which means I can chain the functions | |
-- and also chain after initialisation | |
-- I like the brevity but I'm no Lua expert. Any thoughts? :) | |
function CippyGame:titleScreen() | |
local keepGoing = true | |
local components = { | |
text = TextWindowComp() | |
:borders ( { 10, 20 } ) | |
:col ( { 1, 1, 1, 1 } ) | |
:size( 10 ) | |
:center( 100, "AWFUL GENERIC GAME!" ) | |
:col ( { 1,0,1,1 } ) | |
:size( 3 ) | |
:center( 200, "PRESS START" ), | |
} | |
local ents = Entity { components = components } | |
while keepGoing do | |
local pad = self.game:getControls() | |
keepGoing = pad.action.pressed == false | |
ents:update() | |
self:sleep() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment