Add table.getn() for compatibility

This commit is contained in:
James Roseborough
2007-12-08 01:20:30 +00:00
parent 9706564647
commit 0f3fe0452d
2 changed files with 28 additions and 15 deletions

View File

@@ -21,17 +21,17 @@ tryconcat( {} )
-- insert, maxn
print( '-- insert, maxn tests' )
local t = { "one", "two", "three", a='aaa', b='bbb', c='ccc' }
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
table.insert(t,'six')
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
table.insert(t,1,'seven')
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
table.insert(t,4,'eight')
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
table.insert(t,7,'nine')
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
table.insert(t,10,'ten')
print( table.concat(t,'-'), table.maxn(t), #t )
print( table.concat(t,'-'), table.maxn(t), #t, table.getn(t) )
print( t[10] )
print( table.maxn({}), #{} )