Difference between revisions of "Append"
Jump to navigation
Jump to search
imported>Bale m |
imported>Cheesecookie m (Append returns the result, it does not change the original.) |
||
Line 29: | Line 29: | ||
if(equipped_item(slot) != $item[none]) { | if(equipped_item(slot) != $item[none]) { | ||
if(length(gear) != 0) | if(length(gear) != 0) | ||
− | append(gear, ", "); | + | gear = append(gear, ", "); |
− | append(gear, to_string(equipped_item(slot))); | + | gear = append(gear, to_string(equipped_item(slot))); |
} | } | ||
Revision as of 22:32, 7 August 2018
Function Syntax
buffer append(buffer original ,string add )
- original is the buffer to add to
- add is a string to add on
Returns a buffer containing original with add tacked on to the end.
Code Sample
Print a list of all items currently equipped.
buffer gear;
foreach slot in $slots[]
if(equipped_item(slot) != $item[none]) {
if(length(gear) != 0)
gear = append(gear, ", ");
gear = append(gear, to_string(equipped_item(slot)));
}
print("I am wearing: "+ gear);