Unnamed
public lua v1 · immutable--Basic stackdofile("class.lua")--Basic stack classstack = Class() function stack:new() self.count = 0 self.table = {} end function stack:push(item) self.count = self.count + 1 self.table[self.count] = item end function stack:pop() if self.count <= 0 then return nil end oldItem = self.table[self.count] self.table[self.count] = nil self.count = self.count - 1 return oldItem end function stack:top() if self.count <= 0 then return nil end return self.table[self.count] end