[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: tables problem
- From: Mike Atamas <aelfgar@...>
- Date: Sun, 25 Jan 2004 14:41:55 -0500
Hi,
I am having a problem with tables. The culprit is the following
function:
function dep:remove( _name )
for i = 1, table.getn(self.deps), 1
do
if self.deps[i]["name"] == _name
then
table.remove(self.deps, i)
end
end
end
When I call this function I get the following error:
lua: depends.lua:22: attempt to index field `?' (a nil value)
stack traceback:
depends.lua:22: in function `remove'
depends.lua:37: in main chunk
[C]: ?
I checked and i is a valid element in that table. This function does
seem to work when i is the last element of the table. I also tried
typing a number in directly. When I replaced table.remove(self.deps, i)
with table.remove(self.deps, 1) things also failed. Then I tried taking
it out of the for loop, and everything worked.
Can someone help me fix this?
Mike Atamas
aelfgar@aelfgar.com