Difference between revisions of "Keystr"

From OpenEUO
Jump to: navigation, search
m
m (See Also)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Calling Convention ==
+
== Calling Pattern ==
 
Call
 
Call
 
  local r = sl.keystr(arg)
 
  local r = sl.keystr(arg)
Line 9: Line 9:
 
== Usage Example ==
 
== Usage Example ==
  
local s = {[11]=16}
+
  local r = sl.keys(sl)
local t = { [0]='finale', alice='joker', [s]='88'}
+
  local r = sl.keys(t)
+
 
  print(r)
 
  print(r)
  
  --> 'table keys = {'
+
  --> table keys = {
--> '0,'
+
    argval,
--> 'alice,'
+
    null,
--> 'table: 0x01527a80,'
+
    clrerrors,
--> '}'
+
    probe,
 +
    convert,
 +
    geterror,
 +
    spin,
 +
    luo,
 +
    case,
 +
    ERR,
 +
    slversion,
 +
    macro,
 +
    keys,
 +
    str,
 +
    file,
 +
    keystr,
 +
    slverbosity,
 +
    non,
 +
    testdummy,
 +
    target,
 +
    slredirect,
 +
    iterator,
 +
    try,
 +
    journal,
 +
    keyvalstr,
 +
    slimport,
 +
    }
  
 
== Description ==
 
== Description ==
Line 27: Line 48:
  
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib]
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib]
 +
 +
* [[exkeyvalstr]]
  
 
* [[keys]]
 
* [[keys]]
  
 
* [[keyvalstr]]
 
* [[keyvalstr]]
 +
 +
* [[tabletolua]]

Latest revision as of 17:42, 8 January 2011

Calling Pattern

Call

local r = sl.keystr(arg)

Args

arg is a table

Results

r is a string

Usage Example

local r = sl.keys(sl)
print(r)
--> table keys = {
    argval,
    null,
    clrerrors,
    probe,
    convert,
    geterror,
    spin,
    luo,
    case,
    ERR,
    slversion,
    macro,
    keys,
    str,
    file,
    keystr,
    slverbosity,
    non,
    testdummy,
    target,
    slredirect,
    iterator,
    try,
    journal,
    keyvalstr,
    slimport,
    }

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