Freeciv-3.4
Toggle main menu visibility
Main Page
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Loading...
Searching...
No Matches
common
scriptcore
api_specenum.c
Go to the documentation of this file.
1
/*****************************************************************************
2
Freeciv - Copyright (C) 2010 - The Freeciv Project
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; either version 2, or (at your option)
6
any later version.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
*****************************************************************************/
13
14
#ifdef HAVE_CONFIG_H
15
#include <fc_config.h>
16
#endif
17
18
/* dependencies/lua */
19
#include "lua.h"
20
21
/* utilit */
22
#include "
log.h
"
23
24
#include "
api_specenum.h
"
25
26
/**********************************************************************/
29
void
api_specenum_create_table
(
lua_State
*
L
,
const
char
*
name
,
30
lua_CFunction
findex
)
31
{
32
/* Insert a module table in the global environment,
33
* or reuse any preexisting table */
34
lua_getglobal
(
L
,
name
);
35
if
(
lua_isnil
(
L
, -1)) {
36
lua_newtable
(
L
);
37
lua_pushvalue
(
L
, -1);
38
lua_setglobal
(
L
,
name
);
39
}
40
fc_assert_ret
(
lua_istable
(
L
, -1));
41
/* Create a metatable */
42
lua_newtable
(
L
);
/* stack: module mt */
43
lua_pushliteral
(
L
,
"__index"
);
44
lua_pushcfunction
(
L
,
findex
);
/* stack: module mt '__index' index */
45
lua_rawset
(
L
, -3);
/* stack: module mt */
46
lua_setmetatable
(
L
, -2);
/* stack: module */
47
lua_pop
(
L
, 1);
48
}
29
void
api_specenum_create_table
(
lua_State
*
L
,
const
char
*
name
, {
…
}
BODYGUARD_NONE
@ BODYGUARD_NONE
Definition
aiguard.c:37
api_specenum_create_table
void api_specenum_create_table(lua_State *L, const char *name, lua_CFunction findex)
Definition
api_specenum.c:29
api_specenum.h
name
const char * name
Definition
inputfile.c:127
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition
log.h:192
Generated on Sun Mar 9 2025 22:30:14 for Freeciv-3.4 by
1.9.8