Difference between revisions of "Keyvalstr"

From OpenEUO
Jump to: navigation, search
m
m (See Also)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Calling Convention ==
+
== Calling Pattern ==
 
Call
 
Call
 
  local r = sl.keyvalstr(arg)
 
  local r = sl.keyvalstr(arg)
Line 14: Line 14:
 
  print(r)
 
  print(r)
  
  --> 'table keys:values = {'
+
  --> table keys:values = {
--> '0:finale,'
+
    0:finale,
--> 'alice:joker,'
+
    alice:joker,
--> 'table: 0x01532360:88,'
+
    table: 0x01532360:88,
--> '}'
+
    }
  
 
== Description ==
 
== Description ==
  
The helper function keyvalstr returns a human readable string composed of the keys and values found in its sole argument. The keys and values are converted to strings before insertion into the resultant table.  If the sole argument is not a table, then the string 'not a table' is returned. ''future versions of the library may alter the output slightly. the key* helpers aren't intended to convert data into a [[dostring]] compatible format; further additions to the library will address that need.''
+
The helper function keyvalstr returns a human readable string composed of the keys and values found in its sole argument. The keys and values are converted to strings before insertion into the resultant string.  If the sole argument is not a table, then the string 'not a table' is returned. ''future versions of the library may alter the output slightly. the key* helpers aren't intended to convert data into a [[dostring]] compatible format; use [[tabletolua]] to address that need.''
  
 
== See Also ==
 
== See Also ==
  
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib]
 
* [http://www.easyuo.com/openeuo/wiki/index.php/Simplelib simplelib]
 +
 +
* [[exkeyvalstr]]
  
 
* [[keys]]
 
* [[keys]]
  
 
* [[keystr]]
 
* [[keystr]]
 +
 +
* [[tabletolua]]

Latest revision as of 18:41, 8 January 2011

Calling Pattern

Call

local r = sl.keyvalstr(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.keyvalstr(t)
print(r)
--> table keys:values = {
    0:finale,
    alice:joker,
    table: 0x01532360:88,
    }

Description

The helper function keyvalstr returns a human readable string composed of the keys and values found in its sole argument. The keys and values are converted to strings before insertion into the resultant string. If the sole argument is not a table, then the string 'not a table' is returned. future versions of the library may alter the output slightly. the key* helpers aren't intended to convert data into a dostring compatible format; use tabletolua to address that need.

See Also