ScummVM API documentation
luabindhelper.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/*
23 * This code is based on Broken Sword 2.5 engine
24 *
25 * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
26 *
27 * Licensed under GNU GPL v2
28 *
29 */
30
31#ifndef SWORD25_LUABINDHELPER_H
32#define SWORD25_LUABINDHELPER_H
33
34#include "sword25/kernel/common.h"
35
36#include "common/lua/lua.h"
37#include "common/lua/lauxlib.h"
38
39namespace Sword25 {
40
41#define lua_pushbooleancpp(L, b) (lua_pushboolean(L, b ? 1 : 0))
42#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) != 0)
43
45 const char *Name;
46 lua_Number Value;
47};
48
50public:
60 static bool addFunctionsToLib(lua_State *L, const Common::String &libName, const luaL_reg *functions);
61
71 static bool addConstantsToLib(lua_State *L, const Common::String &libName, const lua_constant_reg *constants);
72
82 static bool addMethodsToClass(lua_State *L, const Common::String &className, const luaL_reg *methods);
83
92 static bool setClassGCHandler(lua_State *L, const Common::String &className, lua_CFunction GCHandler);
93
99
106
107 static bool getMetatable(lua_State *L, const Common::String &tableName);
108
109 static void *my_checkudata(lua_State *L, int ud, const char *tname);
110
111private:
112 static bool createTable(lua_State *L, const Common::String &tableName);
113};
114
115} // End of namespace Sword25
116
117#endif
Definition: str.h:59
Definition: luabindhelper.h:49
static bool addConstantsToLib(lua_State *L, const Common::String &libName, const lua_constant_reg *constants)
static Common::String tableDump(lua_State *L)
static bool setClassGCHandler(lua_State *L, const Common::String &className, lua_CFunction GCHandler)
static Common::String stackDump(lua_State *L)
static bool addFunctionsToLib(lua_State *L, const Common::String &libName, const luaL_reg *functions)
static bool addMethodsToClass(lua_State *L, const Common::String &className, const luaL_reg *methods)
Definition: console.h:27
Definition: luabindhelper.h:44
Definition: lstate.h:100
Definition: lobject.h:59