var/list/entries = list() //Our list holding lists in our table. Holds our columns.
...
New(columns)
world.log << "Creating [columns] columns..."
columns = text2num(columns) //make sure this is a number
if (columns == null)
columns=0
for (var/a = 1,a <= columns, a++)
var/list/col = list() //An empty list (our "column") should be initialized.
entries += col //Place it into our columns list
world.log << "[entries.len]" //returns 0? Seems that empty lists are not even created/are just chucked out?
...
//Something's broken. var/list/col = list() should be a list, not set itself as a value.
Problem description:
I was creating my own implementation of a resizable table, because, well, as far as I know arrays aren't resizable (ex. array[num] = new) but lists() are. But after toying around and noticing some odd proc crashes, of particular they are mainly saying that the indices were out of bounds. That shouldn't be right, as there should be empty lists...
I then decide to initialize each list (col) with a null entry, and there were, as expected, three columns(and of course plenty of proc crashes ripe for debugging).
I then tried to initialize with "test" (var/list/col = list("test"); should have had one entry) and I got THIS error:
runtime error: Cannot read "test".len
proc name: AddRow (/Table/proc/AddRow)
source file: Tables.dm,54
usr: null
src: /Table (/Table)
call stack:
/Table (/Table): AddRow(1)
/SpawnManager (/SpawnManager): BuildSpawnList("\n1 13\n1 13\n1 13\n1 14\n1 14...")
/Database/RoomBuilder (/Database/RoomBuilder): Build()
world: BuildDatabases()
world: Setup()
world: New()
runtime error: Cannot read "test".len
However, initializing with var/list/col = list(list()) places a list there.
Which pretty much means that instead of a list, I get a value instead. Does anyone else get this?
[Edit]
And as for your error, looking over it real quick I don't see the problem. You'd have to show your AddRow() method to work it out.