ScummVM API documentation
to_lua.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_TO_LUA_H
23 #define TETRAEDGE_TO_LUA_H
24 
25 struct lua_State;
26 typedef int (*lua_CFunction)(lua_State *state);
27 
28 namespace Tetraedge {
29 
30 /*
31  * The functions in here are basically the ones implemented by the "tolua" library.
32  * They were reimplemented as a simpler subset required by this engine, but
33  * referencing the tolua code.
34  *
35  * The original tolua copyright notice is:
36  *
37  * Support code for Lua bindings.
38  * Written by Waldemar Celes
39  * TeCGraf/PUC-Rio
40  * Apr 2003
41  * This code is free software; you can redistribute it and/or modify it.
42  * The software provided hereunder is on an "as is" basis, and
43  * the author has no obligation to provide maintenance, support, updates,
44  * enhancements, or modifications.
45  */
46 namespace ToLua {
47 
48 struct tolua_Error {
49  int index;
50  bool array;
51  const char *type;
52 };
53 
54 void tolua_open(lua_State *L);
55 void tolua_module (lua_State *L, const char *name, int hasvar);
56 void tolua_beginmodule (lua_State *L, const char *name);
57 void tolua_endmodule(lua_State *L);
58 void tolua_function(lua_State *L, const char *name, lua_CFunction func);
59 
60 int tolua_isboolean(lua_State *L, int lo, int def, tolua_Error *err);
61 int tolua_isnoobj(lua_State *L, int lo, tolua_Error *err);
62 int tolua_isnumber(lua_State *L, int lo, int def, tolua_Error *err);
63 int tolua_isstring(lua_State *L, int lo, int def, tolua_Error *err);
64 
65 double tolua_tonumber(lua_State *L, int narg, double def);
66 const char* tolua_tostring(lua_State *L, int narg, const char *def);
67 void* tolua_tousertype(lua_State *L, int narg, void *def);
68 bool tolua_toboolean(lua_State *L, int narg, bool def);
69 
70 void tolua_pushboolean(lua_State *L, bool val);
71 void tolua_pushnumber(lua_State *L, double val);
72 void tolua_pushstring(lua_State *L, const char *val);
73 
74 } // end namespace ToLua
75 
76 } // end namespace Tetraedge
77 
78 #endif // TETRAEDGE_TO_LUA_H
Definition: detection.h:27
Definition: lstate.h:100
Definition: to_lua.h:48