Freeciv-3.2
Loading...
Searching...
No Matches
Functions
luascript_func.h File Reference
#include "support.h"

Go to the source code of this file.

Functions

void luascript_func_init (struct fc_lua *fcl)
 
void luascript_func_free (struct fc_lua *fcl)
 
bool luascript_func_check (struct fc_lua *fcl, struct strvec *missing_func_required, struct strvec *missing_func_optional)
 
void luascript_func_add_valist (struct fc_lua *fcl, const char *func_name, bool required, int nargs, int nreturns, va_list args)
 
void luascript_func_add (struct fc_lua *fcl, const char *func_name, bool required, int nargs, int nreturns,...)
 
bool luascript_func_call_valist (struct fc_lua *fcl, const char *func_name, va_list args)
 
bool luascript_func_call (struct fc_lua *fcl, const char *func_name,...)
 
bool luascript_func_is_required (struct fc_lua *fcl, const char *func_name)
 

Function Documentation

◆ luascript_func_add()

void luascript_func_add ( struct fc_lua fcl,
const char func_name,
bool  required,
int  nargs,
int  nreturns,
  ... 
)

Add a lua function.

Definition at line 178 of file luascript_func.c.

Referenced by script_server_functions_define().

◆ luascript_func_add_valist()

void luascript_func_add_valist ( struct fc_lua fcl,
const char func_name,
bool  required,
int  nargs,
int  nreturns,
va_list  args 
)

Add a lua function.

Definition at line 130 of file luascript_func.c.

Referenced by luascript_func_add().

◆ luascript_func_call()

bool luascript_func_call ( struct fc_lua fcl,
const char func_name,
  ... 
)

Call a lua function; return value is TRUE if no errors occurred, otherwise FALSE.

Example call to the lua function 'user_load()': success = luascript_func_call(L, "user_load", pconn, &password);

Definition at line 269 of file luascript_func.c.

◆ luascript_func_call_valist()

bool luascript_func_call_valist ( struct fc_lua fcl,
const char func_name,
va_list  args 
)

Call a lua function; return value is TRUE if no errors occurred, otherwise FALSE.

Example call to the lua function 'user_load()': success = luascript_func_call(L, "user_load", pconn, &password);

Definition at line 220 of file luascript_func.c.

Referenced by luascript_func_call(), script_fcdb_call(), and script_server_call().

◆ luascript_func_check()

bool luascript_func_check ( struct fc_lua fcl,
struct strvec missing_func_required,
struct strvec missing_func_optional 
)

Test if all function are defined. If it fails (return value FALSE), the missing functions are listed in 'missing_func_required' and 'missing_func_optional'.

Definition at line 94 of file luascript_func.c.

◆ luascript_func_free()

void luascript_func_free ( struct fc_lua fcl)

Free the function definitions.

Definition at line 192 of file luascript_func.c.

Referenced by luascript_destroy().

◆ luascript_func_init()

void luascript_func_init ( struct fc_lua fcl)

Initialize the structures needed to save functions definitions.

Definition at line 203 of file luascript_func.c.

Referenced by script_fcdb_init(), and script_server_init().

◆ luascript_func_is_required()

bool luascript_func_is_required ( struct fc_lua fcl,
const char func_name 
)

Return iff the function is required.

Definition at line 284 of file luascript_func.c.