]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/common/c_types.h
Remove unused functions reported by cppcheck (#10463)
[dragonfireclient.git] / src / script / common / c_types.h
1 /*
2 Minetest
3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 extern "C" {
23 #include "lua.h"
24 }
25
26 #include <iostream>
27
28 #include "exceptions.h"
29
30 struct EnumString
31 {
32         int num;
33         const char *str;
34 };
35
36 class StackUnroller
37 {
38 private:
39         lua_State *m_lua;
40         int m_original_top;
41 public:
42         StackUnroller(lua_State *L):
43                 m_lua(L),
44                 m_original_top(-1)
45         {
46                 m_original_top = lua_gettop(m_lua); // store stack height
47         }
48         ~StackUnroller()
49         {
50                 lua_settop(m_lua, m_original_top); // restore stack height
51         }
52 };
53
54 class LuaError : public ModError
55 {
56 public:
57         LuaError(const std::string &s) : ModError(s) {}
58 };
59
60
61 extern EnumString es_ItemType[];