Difference between revisions of "Append"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
imported>Bale
m
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=String Handling Routines|
 
  
 
function1={{Function|
 
function1={{Function|
Line 40: Line 39:
 
see_also={{SeeAlso|append_tail}}|
 
see_also={{SeeAlso|append_tail}}|
 
}}
 
}}
 +
 +
[[Category:String Handling Routines]]

Revision as of 05:13, 22 May 2010

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)
         append(gear, ", ");
      append(gear, to_string(equipped_item(slot)));
   }

print("I am wearing: "+ gear);

See Also

append_tail()