#include "functionjoin.h" #include "gamestate.h" #include using namespace Bu; FunctionJoin::FunctionJoin() { } FunctionJoin::~FunctionJoin() { } void FunctionJoin::call( class GameState &gState ) { Variable vSep = gState.popDeref().to( Variable::tString ); Variable vLst = gState.popDeref(); if( vLst.getType() != Variable::tList ) throw Bu::ExceptionBase("First parameter of join must be a list."); Bu::String sOut; for( Variable::VariableArray::const_iterator i = vLst.getList().begin(); i; i++ ) { if( i != vLst.getList().begin() ) sOut += vSep.getString(); sOut += (*i).to( Variable::tString ).getString(); } gState.push( sOut ); }