MemberInsert (open)
Insert a member in an object
Syntax
// Core function, no LOADLIB necessary
OBJECT FUNCTION MemberInsert(OBJECT obj, STRING membername, BOOLEAN make_private, VARIANT value)
Parameters
OBJECT obj
Object to modify
STRING membername
Name of the member to insert
BOOLEAN make_private
Whether the member must only be accessible using the @a this-> construct.
VARIANT value
Value for the member
Return value
OBJECT
The object with the new member inserted.
Description
MemberInsert inserts the specified member in the object. Member names are case-insensitive. MemberInsert can be used to insert members with a dynamically generated name.
If the member already exists in @italic obj, an error is generated.
Examples
// Insert a mydata member into a file object
OBJECT myfile := FindFile(15);
myfile := MemberInsert(myfile, "mydata", "Hello, World!");