All pastes #797733 Raw Edit

Unnamed

public lua v1 · immutable
#797733 ·published 2007-11-26 05:36 UTC
rendered paste body
--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