Debian Codegraph @

engine/include/luacallback.h

raw
1 // ____ _ __
2 // / __ )____ _____ | | / /___ ___________
3 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
4 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
5 // /_____/\____/____/ |__/|__/\__,_/_/ /____/
6 //
7 // A futuristic real-time strategy game.
8 // This file is part of Bos Wars.
9 //
10 /**@name luacallback.h. */
11 //
12 // (c) Copyright 2008 by Francois Beerten
13 //
14 // This program is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; only version 2 of the License.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 // 02111-1307, USA.
27
28 #ifndef LUA_CALLBACK_HEADER_FILE
29 #define LUA_CALLBACK_HEADER_FILE
30
31 #include <string>
32
33 typedef int lua_Object; // from tolua++.h
34 struct lua_State;
35
36 class LuaCallback
37 {
38 lua_State *luastate;
39
40 // Integer key of the callback function in the Lua registry.
41 int luaref;
42
43 // Number of arguments pushed for the function.
44 int arguments;
45
46 // The top of the Lua stack before pushPreamble().
47 int base;
48
49 public:
50 LuaCallback(lua_State *lua, lua_Object luaref);
51 virtual ~LuaCallback();
52 virtual void pushPreamble();
53 virtual void pushInteger(int value);
54 virtual void pushString(const std::string &eventId);
55 virtual void run();
56 };
57
58 #endif
59