Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
scripting_server.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#include "cpp_api/s_base.h"
7#include "cpp_api/s_entity.h"
8#include "cpp_api/s_env.h"
11#include "cpp_api/s_node.h"
12#include "cpp_api/s_player.h"
13#include "cpp_api/s_server.h"
14#include "cpp_api/s_security.h"
15#include "cpp_api/s_async.h"
16
17struct PackedValue;
18
19/*****************************************************************************/
20/* Scripting <-> Server Game Interface */
21/*****************************************************************************/
22
24 virtual public ScriptApiBase,
25 public ScriptApiAsync,
26 public ScriptApiDetached,
27 public ScriptApiEntity,
28 public ScriptApiEnv,
30 public ScriptApiNode,
31 public ScriptApiPlayer,
32 public ScriptApiServer,
34{
35public:
37
38 void loadBuiltin();
39 // use ScriptApiBase::loadMod() to load mods
40
41 // Save globals that are copied into other Lua envs
42 void saveGlobals();
43
44 // Initialize async engine, call this AFTER loading all mods
45 void initAsync() override;
46
47protected:
48 // from ScriptApiSecurity:
49 bool checkPathInternal(const std::string &abs_path, bool write_required,
50 bool *write_allowed) override {
52 abs_path, write_required, write_allowed);
53 }
54 bool modNamesAreTrusted() override { return true; }
55
56private:
57 void InitializeModApi(lua_State *L, int top);
58
59 static void InitializeAsync(lua_State *L, int top);
60};
Definition s_async.h:239
Definition s_base.h:63
lua_State * getStack()
Definition s_base.h:142
Definition s_inventory.h:14
Definition s_entity.h:17
Definition s_env.h:18
Definition s_modchannels.h:12
Definition s_node.h:18
Definition s_player.h:19
Definition s_security.h:28
static bool checkPathWithGamedef(lua_State *L, const std::string &abs_path, bool write_required, bool *write_allowed)
Definition s_security.cpp:608
Definition s_server.h:12
Definition scripting_server.h:34
void loadBuiltin()
Definition scripting_server.cpp:83
void initAsync() override
Definition scripting_server.cpp:106
bool modNamesAreTrusted() override
Specify if the mod names during init time(!) can be trusted.
Definition scripting_server.h:54
ServerScripting(Server *server)
Definition scripting_server.cpp:41
void InitializeModApi(lua_State *L, int top)
Definition scripting_server.cpp:122
void saveGlobals()
Definition scripting_server.cpp:89
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_server.h:49
static void InitializeAsync(lua_State *L, int top)
Definition scripting_server.cpp:162
Definition server.h:178
Definition activeobjectmgr.cpp:11
A packed value can be a primitive like a string or number but also a table including all of its conte...
Definition c_packer.h:72