Can you modify structures

Freeform discussion about anything related to modding Transcendence.
Post Reply
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

Am I missing something, or are structures effectively a static datatype - i.e. once created it is not possible to modify the contents of a structure. Is this intentional, or just because they are a new addition to the engine?

I would like to be able to use lnkAppend, lnkRemove, lnkReplace (or similar functions) to add/remove/replace key,value pairs from structures.

At the moment the lnk* functions do not work if passed a structure, while other list functions silently convert the structure to a list:

map, enum: behave as if the structure as a list of (key value) lists e.g. (map {q:3 w:4} it it) returns ((q 3) (w 4))

subset, filter, append, shuffle, match: behave as if the structure is a list of the values e.g. (append {q:3 w:4} {e:5}) returns (3 4 5)
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

giantcabbage wrote:Am I missing something, or are structures effectively a static datatype - i.e. once created it is not possible to modify the contents of a structure. Is this intentional, or just because they are a new addition to the engine?

I would like to be able to use lnkAppend, lnkRemove, lnkReplace (or similar functions) to add/remove/replace key,value pairs from structures.

At the moment the lnk* functions do not work if passed a structure, while other list functions silently convert the structure to a list:

map, enum: behave as if the structure as a list of (key value) lists e.g. (map {q:3 w:4} it it) returns ((q 3) (w 4))

subset, filter, append, shuffle, match: behave as if the structure is a list of the values e.g. (append {q:3 w:4} {e:5}) returns (3 4 5)
You can use setItem on a structure:

Code: Select all

(setItem structure key newValue) -> value
NOTE: The above changes the structure in-place.

In the future I want to add structure support to the other functions that you mentioned. Please write up tickets for the functions that are most useful to you and I'll deal with them in order.
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

Thanks - I think setItem is all I need, I'll add tickets for the others if I find a need for them.

I see now that it was all in the 1.07 announcement post (must learn to use the search page)
Post Reply