blob: 71ee87948a362a43eb5b9051748accc6e9e70900 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "functionjoin.h"
#include "gamestate.h"
#include <bu/sio.h>
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 );
}
|