Changed how userdata is handled

This commit is contained in:
2021-02-25 14:09:16 -05:00
parent 5f783e643b
commit 6405c34938
9 changed files with 88 additions and 167 deletions

View File

@@ -2,6 +2,7 @@
#define GUI_HPP
#include <string>
#include <map>
#include <vector>
#include "luastack.hpp"
@@ -34,7 +35,17 @@ public:
void clear() { elts_.clear(); }
bool has_action(const std::string &action) const;
void menu_item(const std::string &action, const std::string &label);
// Put a pointer to a gui into the lua registry.
//
// All lua commands that manipulate the GUI implicitly
// operate on this global gui pointer.
//
static void store_global_pointer(lua_State *L, Gui *g);
static Gui *fetch_global_pointer(lua_State *L);
};
using GuiResult = std::map<std::string, std::string>;
#endif // GUI_HPP