Difference between revisions of "Keys"
From OpenEUO
					
										
					
					| m (Created page with "''keys implemented, but undocumented''  Function keys returns a table of the keys found in its sole argument.") | m (→See Also) | ||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | == Calling Pattern == | |
| + | Call | ||
| + |  local r = sl.keys(arg) | ||
| + | Args | ||
| + |  arg is a table | ||
| + | Results | ||
| + |  r is a table of strings | ||
| − | + | == Usage Example == | |
| + | |||
| + |  local s = {[11]=16} | ||
| + |  local t = { [0]='finale', alice='joker', [s]='88'} | ||
| + |  local r = sl.keys(t) | ||
| + |  print(r[1]) | ||
| + |  print(r[2]) | ||
| + |  print(r[3]) | ||
| + | |||
| + |  --> 0 | ||
| + |      alice | ||
| + |      table: 0x01532f08 | ||
| + | |||
| + | == Description == | ||
| + | |||
| + | The helper function keys returns a table of the keys found in its sole argument. The keys are converted to strings before insertion into the resultant table.  If the sole argument is not a table, then an empty table is returned. | ||
| + | |||
| + | == See Also == | ||
| + | |||
| + | * [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | ||
| + | |||
| + | * [[exkeyvalstr]] | ||
| + | |||
| + | * [[keystr]] | ||
| + | |||
| + | * [[keyvalstr]] | ||
| + | |||
| + | * [[tabletolua]] | ||
Latest revision as of 18:42, 8 January 2011
Calling Pattern
Call
local r = sl.keys(arg)
Args
arg is a table
Results
r is a table of strings
Usage Example
local s = {[11]=16}
local t = { [0]='finale', alice='joker', [s]='88'}
local r = sl.keys(t)
print(r[1])
print(r[2])
print(r[3])
--> 0
    alice
    table: 0x01532f08
Description
The helper function keys returns a table of the keys found in its sole argument. The keys are converted to strings before insertion into the resultant table. If the sole argument is not a table, then an empty table is returned.
