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
65
66
67
68
69
70
71
72
73
74
75
76
|
#ifndef __BLUA_H__
#define __BLUA_H__
#include <lua.h>
#include <map>
#include <Exceptions.h>
#include <Handle.h>
class Lua : public Base {
public:
Lua();
Lua(const Lua &) throw (GeneralException);
virtual ~Lua();
void open_base();
void open_table();
void open_io();
void open_string();
void open_math();
void open_debug();
void declarefunc(const String &, lua_CFunction, int = LUA_GLOBALSINDEX);
void call(const String &, int = LUA_GLOBALSINDEX, int = 0, int = 0);
void call(int = 0, int = 0);
void push();
void push(lua_Number);
void push(const String &);
void push(bool);
void push(void *);
void push(lua_CFunction, int = 0);
void pop(int = 1);
void newtable();
void settable(int = -3);
void gettable(int = -2);
int gettop();
void error(const String &);
int type(int = -1);
bool isnil(int = -1);
bool isboolean(int = -1);
bool isnumber(int = -1);
bool isstring(int = -1);
bool istable(int = -1);
bool isfunction(int = -1);
bool iscfunction(int = -1);
bool isuserdata(int = -1);
bool islightuserdata(int = -1);
bool toboolean(int = -1);
lua_Number tonumber(int = -1);
String tostring(int = -1);
lua_CFunction tocfunction(int = -1);
void * touserdata(int = -1);
Lua * tothread(int = -1);
void load(Handle *) throw (GeneralException) ;
Lua * thread();
static Lua * find(lua_State *) throw (GeneralException);
void showerror();
int getmetatable(int = -1);
int setmetatable(int = -2);
private:
Lua(lua_State *);
lua_State * L;
static std::map<lua_State *, Lua *> lualist;
};
class LuaObject : public Base {
public:
LuaObject() : wantdestruct(false), pushed(false) {}
virtual void push(Lua *) throw (GeneralException);
static void * getme(Lua *, int = 1) throw (GeneralException);
void pushdestruct(Lua *) throw (GeneralException);
protected:
virtual void pushmembers(Lua *) = 0;
void pushme(Lua *, void *);
static void pushit(Lua *, const String &, lua_CFunction);
bool wantdestruct, pushed;
};
#endif
|