Method `[]=()
- Method
`[]=
mixed`[]=(objectarg,mixedindex,mixedval)
mixed`[]=(objectarg,stringindex,mixedval)
mixed`[]=(arrayarg,intindex,mixedval)
mixed`[]=(mappingarg,mixedindex,mixedval)
bool`[]=(multisetarg,mixedindex,boolval)- Description
Index assignment.
Every lvalue expression with the
[]operator becomes a call to this function, i.e.a[b]=cis the same aspredef::`[]=(a,b,c).If
argis an object that implements lfun::`[]=(), that function will be called withindexandvalas the arguments.argcan have any of the following types:objectThe non-protected (ie public) variable named
indexwill be looked up inarg, and assignedval.array|mappingIndex
indexinargwill be assignedval.multisetIf
valis0(zero), one occurrance ofindexinargwill be removed. Otherwiseindexwill be added toargif it is not already there.- Returns
valwill be returned.- Note
An indexing expression in a non-lvalue context, i.e. where the index is being queried instead of assigned, uses `[] instead of this function.
- See also