Navigation menu

WoW:API getn: Difference between revisions

Jump to navigation Jump to search
221 bytes added ,  18 May 2007
The # operator is NOT syntactic sugar, table.getn() is deprecated and # MUST be used
mNo edit summary
(The # operator is NOT syntactic sugar, table.getn() is deprecated and # MUST be used)
Line 3: Line 3:


  table.getn(table)
  table.getn(table)
{{band-red|'''Warning:''' This article discusses use of a deprecated function. This function should no longer be used in Lua 5.1 and may be removed in the future. Use of it will result in potential future incompatibility.}}


This is used to determine the size of a table. The size of a table is discussed at the top of this page.
This is used to determine the size of a table. The size of a table is discussed at the top of this page.
Line 17: Line 19:
  3
  3


Note that Lua 5.1 supports the use of the # operator.  #t is syntactic sugar for table.getn(t)
Note that Lua 5.1 has switched to the # operator.  #t is the replacement for table.getn(t)


   > print( #{1,2,3} )
   > print( #{1,2,3} )