Freeciv21
Develop your civilization from humble roots to a global empire
api_signal_base.h
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 #pragma once
12 
13 // utility
14 #include "support.h"
15 
16 struct lua_State;
17 
18 void api_signal_connect(lua_State *L, const char *signal_name,
19  const char *callback_name);
20 void api_signal_remove(lua_State *L, const char *signal_name,
21  const char *callback_name);
22 bool api_signal_defined(lua_State *L, const char *signal_name,
23  const char *callback_name);
24 
25 const char *api_signal_callback_by_index(lua_State *L,
26  const char *signal_name,
27  int sindex);
28 
29 const char *api_signal_by_index(lua_State *L, int sindex);
const char * api_signal_by_index(lua_State *L, int sindex)
Return the name of the 'index' callback function of the signal with the name 'signal_name'.
bool api_signal_defined(lua_State *L, const char *signal_name, const char *callback_name)
Returns if a callback function to a certain signal is defined.
const char * api_signal_callback_by_index(lua_State *L, const char *signal_name, int sindex)
Return the name of the signal with the given index.
void api_signal_connect(lua_State *L, const char *signal_name, const char *callback_name)
Connects a callback function to a certain signal.
void api_signal_remove(lua_State *L, const char *signal_name, const char *callback_name)
Removes a callback function to a certain signal.