51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef C_TYPES_H_
-#define C_TYPES_H_
+#pragma once
extern "C" {
#include "lua.h"
#include <iostream>
+#include "exceptions.h"
+
struct EnumString
{
int num;
}
};
-class ModNameStorer
-{
-private:
- lua_State *L;
-public:
- ModNameStorer(lua_State *L_, const std::string modname):
- L(L_)
- {
- // Store current modname in registry
- lua_pushstring(L, modname.c_str());
- lua_setfield(L, LUA_REGISTRYINDEX, "minetest_current_modname");
- }
- ~ModNameStorer()
- {
- // Clear current modname in registry
- lua_pushnil(L);
- lua_setfield(L, LUA_REGISTRYINDEX, "minetest_current_modname");
- }
-};
-
-class LuaError : public std::exception
+class LuaError : public ModError
{
public:
- LuaError(lua_State *L, const std::string &s);
-
- virtual ~LuaError() throw()
- {}
- virtual const char * what() const throw()
- {
- return m_s.c_str();
- }
- std::string m_s;
+ LuaError(const std::string &s) : ModError(s) {}
};
extern EnumString es_ItemType[];
-
-#endif /* C_TYPES_H_ */