Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
script_client.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include "lua.h"
#include "lualib.h"
#include "tolua.h"
#include "log.h"
#include "featured_text.h"
#include "api_game_specenum.h"
#include "luascript.h"
#include "tolua_common_a_gen.h"
#include "tolua_common_z_gen.h"
#include "tolua_game_gen.h"
#include "tolua_signal_gen.h"
#include "luaconsole_common.h"
#include <tolua_client_gen.h>
#include "script_client.h"

Go to the source code of this file.

Functions

static void script_client_vars_init (void)
 
static void script_client_vars_free (void)
 
static void script_client_vars_load (struct section_file *file)
 
static void script_client_vars_save (struct section_file *file)
 
static void script_client_code_init (void)
 
static void script_client_code_free (void)
 
static void script_client_code_load (struct section_file *file)
 
static void script_client_code_save (struct section_file *file)
 
static void script_client_output (struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__
 
static void static void script_client_signal_create (void)
 
bool script_client_do_string (const char *str)
 
bool script_client_do_file (const char *filename)
 
bool script_client_callback_invoke (const char *callback_name, int nargs, enum api_types *parg_types, va_list args)
 
void script_client_remove_exported_object (void *object)
 
bool script_client_init (void)
 
void script_client_free (void)
 
void script_client_state_load (struct section_file *file)
 
void script_client_state_save (struct section_file *file)
 
void script_client_signal_emit (const char *signal_name,...)
 

Variables

static struct fc_luamain_fcl = NULL
 
static charscript_client_code = NULL
 

Function Documentation

◆ script_client_callback_invoke()

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.

Definition at line 99 of file script_client.c.

◆ script_client_code_free()

static void script_client_code_free ( void  )
static

Free the optional game script code (useful for scenarios).

Definition at line 159 of file script_client.c.

Referenced by script_client_free().

◆ script_client_code_init()

static void script_client_code_init ( void  )
static

Initialize the optional game script code (useful for scenarios).

Definition at line 151 of file script_client.c.

Referenced by script_client_init().

◆ script_client_code_load()

static void script_client_code_load ( struct section_file file)
static

Load the optional game script code from file (useful for scenarios).

Definition at line 170 of file script_client.c.

Referenced by script_client_state_load().

◆ script_client_code_save()

static void script_client_code_save ( struct section_file file)
static

Save the optional game script code to file (useful for scenarios).

Definition at line 185 of file script_client.c.

Referenced by script_client_state_save().

◆ script_client_do_file()

bool script_client_do_file ( const char filename)

Parse and execute the script at filename.

Definition at line 89 of file script_client.c.

Referenced by luaconsole_load_file_callback(), qload_lua_script(), and qreload_lua_script().

◆ script_client_do_string()

bool script_client_do_string ( const char str)

Parse and execute the script in str

Definition at line 79 of file script_client.c.

Referenced by luaconsole_input_return().

◆ script_client_free()

void script_client_free ( void  )

Free the scripting data.

Definition at line 283 of file script_client.c.

Referenced by client_exit().

◆ script_client_init()

bool script_client_init ( void  )

Initialize the scripting state.

Definition at line 195 of file script_client.c.

Referenced by client_main().

◆ script_client_output()

static void script_client_output ( struct fc_lua fcl,
enum log_level  level,
const char format,
  ... 
)
static

Output a message on the client lua console.

Definition at line 239 of file script_client.c.

Referenced by script_client_init().

◆ script_client_remove_exported_object()

void script_client_remove_exported_object ( void object)

Mark any, if exported, full userdata representing 'object' in the current script state as 'Nonexistent'. This changes the type of the lua variable.

Definition at line 111 of file script_client.c.

◆ script_client_signal_create()

static void script_client_signal_create ( void  )
static

Declare any new signal types you need here.

Definition at line 332 of file script_client.c.

Referenced by script_client_init().

◆ script_client_signal_emit()

void script_client_signal_emit ( const char signal_name,
  ... 
)

Invoke all the callback functions attached to a given signal.

Definition at line 320 of file script_client.c.

Referenced by handle_research_info().

◆ script_client_state_load()

void script_client_state_load ( struct section_file file)

Load the scripting state from file.

Definition at line 299 of file script_client.c.

◆ script_client_state_save()

void script_client_state_save ( struct section_file file)

Save the scripting state to file.

Definition at line 311 of file script_client.c.

◆ script_client_vars_free()

static void script_client_vars_free ( void  )
static

Free the game script variables.

Definition at line 127 of file script_client.c.

Referenced by script_client_free().

◆ script_client_vars_init()

static void script_client_vars_init ( void  )
static

Initialize the game script variables.

Definition at line 119 of file script_client.c.

Referenced by script_client_init().

◆ script_client_vars_load()

static void script_client_vars_load ( struct section_file file)
static

Load the game script variables in file.

Definition at line 135 of file script_client.c.

Referenced by script_client_state_load().

◆ script_client_vars_save()

static void script_client_vars_save ( struct section_file file)
static

Save the game script variables to file.

Definition at line 143 of file script_client.c.

Referenced by script_client_state_save().

Variable Documentation

◆ main_fcl

struct fc_lua* main_fcl = NULL
static

◆ script_client_code

char* script_client_code = NULL
static