Freeciv-3.2
|
#include <stdarg.h>
#include "lua.h"
#include "lualib.h"
#include "string_vector.h"
#include "luascript.h"
#include "luascript_types.h"
#include "luascript_func.h"
#include "spechash.h"
Go to the source code of this file.
Data Structures | |
struct | luascript_func |
Functions | |
static struct luascript_func * | func_new (bool required, int nargs, enum api_types *parg_types, int nreturns, enum api_types *preturn_types) |
static void | func_destroy (struct luascript_func *pfunc) |
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,...) |
void | luascript_func_free (struct fc_lua *fcl) |
void | luascript_func_init (struct fc_lua *fcl) |
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) |
#define luascript_func_hash_keys_iterate | ( | phash, | |
key | |||
) | TYPED_HASH_KEYS_ITERATE(char *, phash, key) |
Definition at line 53 of file luascript_func.c.
#define luascript_func_hash_keys_iterate_end HASH_KEYS_ITERATE_END |
Definition at line 55 of file luascript_func.c.
#define SPECHASH_ASTR_KEY_TYPE |
Definition at line 48 of file luascript_func.c.
#define SPECHASH_IDATA_FREE func_destroy |
Definition at line 50 of file luascript_func.c.
#define SPECHASH_IDATA_TYPE struct luascript_func * |
Definition at line 49 of file luascript_func.c.
#define SPECHASH_TAG luascript_func |
Definition at line 47 of file luascript_func.c.
|
static |
Free a function definition.
Definition at line 80 of file luascript_func.c.
|
static |
Create a new function definition.
Definition at line 61 of file luascript_func.c.
Referenced by luascript_func_add_valist().
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().
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().
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.
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().
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.
Free the function definitions.
Definition at line 192 of file luascript_func.c.
Referenced by luascript_destroy().
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().