Freeciv21
Develop your civilization from humble roots to a global empire
api_server_luadata.cpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3
part of Freeciv21. Freeciv21 is free software: you can redistribute it
4
and/or modify it under the terms of the GNU General Public License as
5
published by the Free Software Foundation, either version 3 of the
6
License, or (at your option) any later version. You should have received
7
a copy of the GNU General Public License along with Freeciv21. If not,
8
see https://www.gnu.org/licenses/.
9
*/
10
11
// utility
12
#include "
registry_ini.h
"
13
14
// common
15
#include "
game.h
"
16
17
/* common/scriptcore */
18
#include "
luascript.h
"
19
20
/* server/scripting */
21
#include "
script_server.h
"
22
23
#include "
api_server_luadata.h
"
24
28
const
char
*
api_luadata_get_str
(lua_State *L,
const
char
*field)
29
{
30
LUASCRIPT_CHECK_STATE
(L,
nullptr
);
31
32
if
(
game
.
server
.luadata ==
nullptr
) {
33
return
nullptr
;
34
}
35
36
return
secfile_lookup_str_default
(
game
.
server
.luadata,
nullptr
,
"%s"
,
37
field);
38
}
api_luadata_get_str
const char * api_luadata_get_str(lua_State *L, const char *field)
Get string value from luadata.
Definition:
api_server_luadata.cpp:28
api_server_luadata.h
game
struct civ_game game
Definition:
game.cpp:47
game.h
luascript.h
LUASCRIPT_CHECK_STATE
#define LUASCRIPT_CHECK_STATE(L,...)
Definition:
luascript.h:110
secfile_lookup_str_default
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
Lookup a string value in the secfile.
Definition:
registry_ini.cpp:2042
registry_ini.h
script_server.h
civ_game::server
struct civ_game::@28::@32 server
server
scripting
api_server_luadata.cpp
Generated by
1.9.1