-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScriptSystem.h
64 lines (52 loc) · 1.48 KB
/
ScriptSystem.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
@file ScriptSystem.h
@author huangwei
@date 2012/12/27
@brief
*/
#pragma once
#ifndef __SCRIPTSYSTEM_H__
#define __SCRIPTSYSTEM_H__
#include <string>
#include <stack>
#include <assert.h>
#include "lua.hpp"
#include "struct_fmt.h"
//////////////////////////////////////////////////////////////////////////
// CLuaTableIterator
//
// ·â×°Lua Table±éÀú
class CLuaTableIterator : public IDiffStruct
{
public:
typedef std::stack <int> TableStack;
public:
CLuaTableIterator(int table);
virtual ~CLuaTableIterator();
virtual bool IterBegin(bool pop);
virtual bool IterNext(const SF_Elem elem);
virtual bool IterIn(const SF_Elem elem);
virtual bool IterOut(const SF_Elem elem);
virtual bool IterArrayIn(const SF_Elem elem);
virtual bool IterArrayNext(const SF_Elem elem, int idx);
virtual bool IterArrayOut(const SF_Elem elem);
virtual bool IterEnd();
virtual bool PushValue(const SF_Elem elem, const SF_BinData& buf);
virtual bool PopValue(const SF_Elem elem, int elem_len, SF_BinData& buf);
protected:
bool IsArrayValue(const SF_Elem elem);
bool NewTableInTop(const char* key);
bool NewTableInTop(int idx);
bool PushTableInTop(const char* key);
bool PushTableInTop(int idx);
bool PushValueInTop(const char* key);
bool PushValueInTop(int idx);
bool PopTableInTop();
bool PopInTop();
protected:
lua_State* m_pLuaState;
TableStack m_stackTable;
bool m_bPop;
int m_nArrayIndex;
};
#endif // __SCRIPTSYSTEM_H__