Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
c_types.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7extern "C" {
8#include "lua.h"
9}
10
11#include "exceptions.h"
12
14{
15private:
16 lua_State *m_lua;
18public:
19 StackUnroller(lua_State *L):
20 m_lua(L),
22 {
23 m_original_top = lua_gettop(m_lua); // store stack height
24 }
26 {
27 lua_settop(m_lua, m_original_top); // restore stack height
28 }
29};
30
31class LuaError : public ModError
32{
33public:
34 LuaError(const std::string &s) : ModError(s) {}
35};
Definition c_types.h:32
LuaError(const std::string &s)
Definition c_types.h:34
Definition exceptions.h:85
Definition c_types.h:14
lua_State * m_lua
Definition c_types.h:16
int m_original_top
Definition c_types.h:17
StackUnroller(lua_State *L)
Definition c_types.h:19
~StackUnroller()
Definition c_types.h:25