I've copied a List "class" and am modifying it so the "new" function can take a variable amount of parameters and it'll add those values to the list itself. However, the 'arg' variable is always nil and I'm not sure why.
List = {}
function List.new(...)
local obj = { first = 0, last = -1 }
if arg ~= nil then
-- push any values passed in
for k,v in pairs(arg) do
List.pushleft(obj, v)
end
end
return obj
end
function List.pushleft(list, value)
local first = list.first - 1
list.first = first
list[first] = value
end
local test = List.new("Food", "Bandage")