Created
February 1, 2017 09:53
-
-
Save lduboeuf/13a8f75b1701e9204c1202d9bab7a482 to your computer and use it in GitHub Desktop.
lua first step 2
This file contains hidden or 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
local firstname = "lionel" | |
local display = print | |
display(firstname) | |
--table as associative array | |
local person = { | |
firstname = "lilil", | |
developer = true, | |
score = 150000, | |
loose = function(self, nb) | |
self.score = self.score - nb | |
end | |
} | |
person.sayHello = function() | |
display("hello "..person.firstname.." score: "..person.score) | |
end | |
--syntactic sugar for person.loose(person, 125000) | |
person:loose(125000) | |
person.sayHello() |
Author
lduboeuf
commented
Feb 1, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment