Luanti 5.10.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 ScriptApiDetached,
26 public ScriptApiEntity,
27 public ScriptApiEnv,
29 public ScriptApiNode,
30 public ScriptApiPlayer,
31 public ScriptApiServer,
33{
34public:
36
37 void loadBuiltin();
38 // use ScriptApiBase::loadMod() to load mods
39
40 // Save globals that are copied into other Lua envs
41 void saveGlobals();
42
43 // Initialize async engine, call this AFTER loading all mods
44 void initAsync();
45
46 // Global step handler to collect async results
47 void stepAsync();
48
49 // Pass job to async threads
50 u32 queueAsync(std::string &&serialized_func,
51 PackedValue *param, const std::string &mod_origin);
52
53private:
54 void InitializeModApi(lua_State *L, int top);
55
56 static void InitializeAsync(lua_State *L, int top);
57
59};
Definition s_async.h:64
Definition s_base.h:64
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:26
Definition s_server.h:12
Definition scripting_server.h:33
void loadBuiltin()
Definition scripting_server.cpp:79
u32 queueAsync(std::string &&serialized_func, PackedValue *param, const std::string &mod_origin)
Definition scripting_server.cpp:123
ServerScripting(Server *server)
Definition scripting_server.cpp:40
void InitializeModApi(lua_State *L, int top)
Definition scripting_server.cpp:130
AsyncEngine asyncEngine
Definition scripting_server.h:58
void saveGlobals()
Definition scripting_server.cpp:85
void initAsync()
Definition scripting_server.cpp:102
static void InitializeAsync(lua_State *L, int top)
Definition scripting_server.cpp:169
void stepAsync()
Definition scripting_server.cpp:118
Definition server.h:167
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