Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
scripting_mainmenu.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
7#include "cpp_api/s_base.h"
10#include "cpp_api/s_async.h"
11
12/*****************************************************************************/
13/* Scripting <-> Main Menu Interface */
14/*****************************************************************************/
15
17 : virtual public ScriptApiBase,
18 public ScriptApiMainMenu,
20{
21public:
22 MainMenuScripting(GUIEngine* guiengine);
23
24 // Global step handler to pass back async events
25 void step();
26
27 // Pass async events from engine to async threads
28 u32 queueAsync(std::string &&serialized_func,
29 std::string &&serialized_param);
30
31 // Is the main menu allowed writeable access to this path?
32 static bool mayModifyPath(const std::string &path);
33
34 // (public implementation so it can be used from AsyncEngine)
35 static bool checkPathAccess(const std::string &abs_path, bool write_required,
36 bool *write_allowed);
37
38protected:
39 bool checkPathInternal(const std::string &abs_path, bool write_required,
40 bool *write_allowed) override {
41 return checkPathAccess(abs_path, write_required, write_allowed);
42 }
43
44private:
45 void initializeModApi(lua_State *L, int top);
46 static void registerLuaClasses(lua_State *L, int top);
47
49};
Definition s_async.h:73
implementation of main menu based uppon formspecs
Definition guiEngine.h:113
Definition scripting_mainmenu.h:20
static bool mayModifyPath(const std::string &path)
Definition scripting_mainmenu.cpp:78
void step()
Definition scripting_mainmenu.cpp:106
AsyncEngine asyncEngine
Definition scripting_mainmenu.h:48
MainMenuScripting(GUIEngine *guiengine)
Definition scripting_mainmenu.cpp:25
static bool checkPathAccess(const std::string &abs_path, bool write_required, bool *write_allowed)
Definition scripting_mainmenu.cpp:94
void initializeModApi(lua_State *L, int top)
Definition scripting_mainmenu.cpp:51
static void registerLuaClasses(lua_State *L, int top)
Definition scripting_mainmenu.cpp:72
bool checkPathInternal(const std::string &abs_path, bool write_required, bool *write_allowed) override
Should check if the given path may be accessed.
Definition scripting_mainmenu.h:39
u32 queueAsync(std::string &&serialized_func, std::string &&serialized_param)
Definition scripting_mainmenu.cpp:111
Definition s_base.h:63
Definition s_mainmenu.h:11
Definition s_security.h:28