Freeciv21
Develop your civilization from humble roots to a global empire
script_client.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 /* common/scriptcore */
14 #include "luascript_types.h"
15 
16 struct section_file;
17 
18 // callback invocation function.
19 bool script_client_callback_invoke(const char *callback_name, int nargs,
20  enum api_types *parg_types, va_list args);
21 
22 // script functions.
23 bool script_client_init();
24 void script_client_free();
25 bool script_client_do_string(const char *str);
26 bool script_client_do_file(const char *filename);
27 
28 /* script state i/o. */
29 void script_client_state_load(struct section_file *file);
30 void script_client_state_save(struct section_file *file);
31 
32 // Signals.
33 void script_client_signal_connect(const char *signal_name,
34  const char *callback_name);
35 void script_client_signal_emit(const char *signal_name, ...);
bool script_client_init()
Initialize the scripting state.
const char * script_client_signal_list()
bool script_client_do_file(const char *filename)
Parse and execute the script at filename.
void script_client_state_load(struct section_file *file)
Load the scripting state from file.
bool script_client_do_string(const char *str)
Parse and execute the script in str.
void script_client_state_save(struct section_file *file)
Save the scripting state to file.
bool script_client_callback_invoke(const char *callback_name, int nargs, enum api_types *parg_types, va_list args)
Invoke the 'callback_name' Lua function.
void script_client_signal_emit(const char *signal_name,...)
Invoke all the callback functions attached to a given signal.
void script_client_free()
Free the scripting data.
void script_client_signal_connect(const char *signal_name, const char *callback_name)