Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class "food"
- {
- eaten=false,
- eat=
- function()
- if self.eaten then
- print("You bite into nothing, it hurts your teeth.")
- else
- print(("The %s has been eaten :("):format(self.name))
- self.eaten=true
- end
- end,
- __settings=
- {
- new=
- function(name)
- print(("Delicous %s has been created!"):format(name))
- return {name=name}
- end,
- mt=
- {
- __gc=
- function(self)
- if not self.eaten then
- print(("You throw the %s into the trash (what a waste)."):format(self.name))
- else
- print(("You throw the crumbs of %s into the trash."):format(self.name))
- end
- end,
- __add=
- function(self,other)
- if type(other)=="userdata" and other.isA("food") then
- print("You smash the two foods together and create:")
- return _G[self.className](("%s-y %s"):format(self.name,other.name))
- end
- end
- }
- }
- }
- class "cake" "food"
- {
- eat=
- function()
- print("LIES!")
- self.eaten=true
- end
- }
- class "candy" "food"
- {
- eat=
- function()
- print("The dentist frowns upon you.")
- self.eaten=true
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement