dofile("util.lua") ice_cream_scoops = { "vanilla", "chocolate"; sprinkles = true } greek_numbers = { ena = "one", dyo = "two", tria = "three" } mt = { __tostring = table_to_string } setmetatable(greek_numbers, mt) Villain = { health = 100, new = function(self, name) obj = { name = name, health = self.health } setmetatable(obj, self) self.__index = self return obj end, take_hit = function(self) self.health = self.health - 10 end } dietrich = Villain:new("Dietrich") SuperVillain = Villain:new() function SuperVillain:take_hit() self.health = self.health - 5 end joker = SuperVillain:new("Joker") function fibonacci() local m = 1 local n = 1 while true do coroutine.yield(m) m, n = n, m+n end end generator = coroutine.create(fibonacci) -- Easy function concatenate(a1, a2) local new = {} for i = 1, #a1 do new[#new+1] = a1[i] end for i = 1, #a2 do new[#new+1] = a2[i] end return new end l1 = {1,2,3} l2 = {4,5,6,7,8} -- Medium -- ???????????????????????????? -- function _G.__add(self, v) -- return concatenate(self, v) -- end