• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

table.remove won't work

hellboy

Intermediate OT User
Joined
Apr 6, 2008
Messages
549
Solutions
6
Reaction score
124
Location
player:getTown()
TFS 0.3.6pl1

Like in title.
Simple example:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
tttt = {[3] = 9, [7] = 55}
table.remove(tttt, 7)
print(table.maxn(tttt))
end

Why this script send to console 7 not 3?:
Code:
[23/04/2010 20:05:12] 7

???
 
Last edited:
Size of the table does not reflect the number of elements (they're not in consecutive order), so nothing is removed.

Use this instead:
Code:
tttt[7] = nil
 
Back
Top