summaryrefslogtreecommitdiff
path: root/src/functioncount.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/functioncount.cpp')
-rw-r--r--src/functioncount.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/functioncount.cpp b/src/functioncount.cpp
new file mode 100644
index 0000000..f879238
--- /dev/null
+++ b/src/functioncount.cpp
@@ -0,0 +1,35 @@
1#include "functioncount.h"
2
3#include "gamestate.h"
4
5FunctionCount::FunctionCount()
6{
7}
8
9FunctionCount::~FunctionCount()
10{
11}
12
13void FunctionCount::call( class GameState &gState )
14{
15 Variable v = gState.popDeref();
16 switch( v.getType() )
17 {
18 case Variable::tList:
19 gState.push( (int64_t)v.getList().getSize() );
20 break;
21
22 case Variable::tDictionary:
23 gState.push( (int64_t)v.getHash().getSize() );
24 break;
25
26 case Variable::tString:
27 gState.push( (int64_t)v.getString().getSize() );
28 break;
29
30 default:
31 gState.push( Variable( Variable::tNull ) );
32 break;
33 }
34}
35