Forum

> > CS2D > Scripts > table index is nil
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch table index is nil

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt table index is nil

scriptmen
User Off Offline

Zitieren
i have some questions about this error - what this error means? when and why table index can become nil and what is table index?

hope you would help me to understand

alt Re: table index is nil

Apache uwu
User Off Offline

Zitieren
As you know, lua tables are actually just arrays.

The table index is an identifier for an array to get a value.

For example:

1
2
3
4
5
6
7
8
9
10
11
a={}
a[2]=4
--2 is the index

b={}
b[function() msg("hello") end]=true
--function() msg("hello") end is the index

c={}
c["hello"]=2
--hello is is the index

When you get the error "table is nil" it's most likely that you used a variable for the table index.

1
awesome[player(id,"name")]=true

In this case, id could have been nil, player returns false or an empty string so that must not have been what caused the index to be nil.

@user Jynxxx: No, table usually means like a SQL table, which is not related to lua arrays.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht