TOARRAY()

From Lianjapedia
Revision as of 02:16, 26 January 2022 by Barrymavin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Function to load a dynamic array / object into a fixed array

Syntax

TOARRAY(<object> [,1] )

See Also

AADD(), AAVERAGE(), ACLASS(), ACOPY(), ADDPROPERTY(), ADEL(), ADESC(), ADIR(), AELEMENT(), AFIELDS(), AFILL(), AINS(), ALEN(), AMAX(), AMEMBERS(), AMIN(), APPEND FROM ARRAY, ARRAY(), ASIZE(), ASORT(), ASTORE(), ASTRING(), ASUBSCRIPT(), ASUM(), COMPOBJ(), COPY TO ARRAY, CREATEOBJECT(), DECLARE, DEFINE CLASS, DIMENSION, DISPLAY CLASSES, DODEFAULT(), FOREACH, GATHER, GETMEMBER(), GETPARAMETER(), IN_ARRAY(), IS_ARRAY(), LIST CLASSES, LOADOBJECT(), LOCAL, NAMESPACE, NAMESPACE(), NEWOBJECT(), OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), PRIVATE, PUBLIC, RELEASE, REMOVEPROPERTY(), REQUIRE_ONCE(), RESTORE, SAVE, SAVEOBJECT(), SCATTER, SET EXACT, SQL SELECT, WITH

Description

The TOARRAY() function is used to create a fixed array and load it with the contents of the specified dynamic array or object, <object>. The array returned by the TOARRAY() function can then be manipulated using the fixed array processing functions.

If the second parameter is specified as a non zero numeric, the array created will be 2D where the first element is the member name and the second its' value. This was added in Lianja 7.0.

Example

myobj = object()
myobj.companyname = "Lianja Inc"
myobj.website = "www.lianja.com"
 
myfixed = toarray(myobj)
? astring(myfixed)
 
// Output
Lianja Inc,www.lianja.com