Difference between revisions of "Keystr"
From OpenEUO
m |
m |
||
Line 1: | Line 1: | ||
− | ''keystr | + | == Calling Convention == |
+ | Call | ||
+ | local r = sl.keystr(arg) | ||
+ | Args | ||
+ | arg is a table | ||
+ | Results | ||
+ | r is a string | ||
+ | |||
+ | == Usage Example == | ||
+ | |||
+ | local s = {[11]=16} | ||
+ | local t = { [0]='finale', alice='joker', [s]='88'} | ||
+ | local r = sl.keys(t) | ||
+ | print(r) | ||
+ | |||
+ | --> 'table keys = {' | ||
+ | --> '0,' | ||
+ | --> 'alice,' | ||
+ | --> 'table: 0x01527a80,' | ||
+ | --> '}' | ||
+ | |||
+ | == Description == | ||
+ | |||
+ | The helper function keystr returns human readable string representation of the keys found in its sole argument. The keys are converted to strings before concatenation into the resultant string. If the sole argument is not a table, then the string 'not a table' is returned. | ||
== See Also == | == See Also == | ||
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | * [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib] | ||
+ | |||
+ | * [[keys]] | ||
+ | |||
+ | * [[keyvalstr]] |
Revision as of 14:42, 2 November 2010
Calling Convention
Call
local r = sl.keystr(arg)
Args
arg is a table
Results
r is a string
Usage Example
local s = {[11]=16} local t = { [0]='finale', alice='joker', [s]='88'} local r = sl.keys(t) print(r)
--> 'table keys = {' --> '0,' --> 'alice,' --> 'table: 0x01527a80,' --> '}'
Description
The helper function keystr returns human readable string representation of the keys found in its sole argument. The keys are converted to strings before concatenation into the resultant string. If the sole argument is not a table, then the string 'not a table' is returned.