Freeciv-3.2
|
#include "tolua.h"
#include "log.h"
#include "support.h"
#include "luascript_types.h"
#include "luascript_func.h"
#include "luascript_signal.h"
Go to the source code of this file.
Data Structures | |
struct | fc_lua |
Macros | |
#define | LUASCRIPT_ASSERT_CAT(str1, str2) str1 ## str2 |
#define | LUASCRIPT_ASSERT(check, ...) |
#define | LUASCRIPT_CHECK_STATE(L, ...) |
#define | LUASCRIPT_CHECK(L, check, msg, ...) |
#define | LUASCRIPT_CHECK_ARG(L, check, narg, msg, ...) |
#define | LUASCRIPT_CHECK_ARG_NIL(L, value, narg, type, ...) |
#define | LUASCRIPT_CHECK_SELF(L, value, ...) |
Typedefs | |
typedef void(* | luascript_log_func_t) (struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__ |
Definition at line 114 of file luascript.h.
Definition at line 103 of file luascript.h.
Definition at line 124 of file luascript.h.
Definition at line 131 of file luascript.h.
Definition at line 138 of file luascript.h.
Definition at line 146 of file luascript.h.
Definition at line 117 of file luascript.h.
typedef void(* luascript_log_func_t) (struct fc_lua *fcl, enum log_level level, const char *format,...) fc__attribute((__format__(__printf__ |
Definition at line 39 of file luascript.h.
Like script_error, but using a prefix identifying the called lua function: bad argument narg to '[func]': msg
Definition at line 324 of file luascript.c.
Evaluate a Lua function call or loaded script on the stack. Return nonzero if an error occurred.
If available pass the source code string as code, else NULL.
Will pop function and arguments (1 + narg values) from the stack. Will push nret return values to the stack.
On error, print an error message with traceback. Nothing is pushed to the stack.
Definition at line 578 of file luascript.c.
Referenced by luascript_callback_invoke(), luascript_do_file(), luascript_do_string(), luascript_func_call_valist(), and luascript_vars_save().
bool luascript_callback_invoke | ( | struct fc_lua * | fcl, |
const char * | callback_name, | ||
int | nargs, | ||
enum api_types * | parg_types, | ||
va_list | args | ||
) |
Invoke the 'callback_name' Lua function.
Definition at line 657 of file luascript.c.
Referenced by luascript_signal_emit_valist(), and script_client_callback_invoke().
Return if the function 'funcname' is define in the lua state 'fcl->state'.
Definition at line 552 of file luascript.c.
Referenced by luascript_func_check().
Free the scripting data.
Definition at line 386 of file luascript.c.
Referenced by script_client_free(), script_client_init(), script_fcdb_free(), script_server_free(), and script_server_init().
Definition at line 789 of file luascript.c.
Referenced by api_find_direction(), api_methods_unit_orientation_get(), api_utilities_dir_ccw(), api_utilities_dir_cw(), api_utilities_opposite_dir(), and api_utilities_str2dir().
Parse and execute the script at filename.
Definition at line 637 of file luascript.c.
Referenced by script_client_do_file(), script_fcdb_init(), and script_server_do_file_shared().
lua_dostring replacement with error message showing on errors.
Definition at line 617 of file luascript.c.
Referenced by luascript_vars_load(), script_client_code_load(), script_client_do_string(), script_fcdb_do_string(), script_server_code_load(), and script_server_do_string_shared().
Internal api error function. Invoking this will cause Lua to stop executing the current context and throw an exception, so to speak.
Definition at line 308 of file luascript.c.
Referenced by luascript_error().
Get the freeciv lua struct from a lua state.
Definition at line 366 of file luascript.c.
Referenced by api_edit_create_player(), api_edit_create_unit_full(), api_signal_by_index(), api_signal_callback_by_index(), api_signal_connect(), api_signal_defined(), api_signal_remove(), and api_utilities_log_base().
void void luascript_log_vargs | ( | struct fc_lua * | fcl, |
enum log_level | level, | ||
const char * | format, | ||
va_list | args | ||
) |
Print a message to the selected output handle.
Definition at line 422 of file luascript.c.
Referenced by luascript_log().
struct fc_lua * luascript_new | ( | luascript_log_func_t | output_fct, |
bool | secured_environment | ||
) |
Initialize the scripting state.
Definition at line 332 of file luascript.c.
Referenced by script_client_init(), script_fcdb_init(), and script_server_init().
void luascript_pop_returns | ( | struct fc_lua * | fcl, |
const char * | func_name, | ||
int | nreturns, | ||
enum api_types * | preturn_types, | ||
va_list | args | ||
) |
Pop return values from the Lua stack.
Definition at line 442 of file luascript.c.
Referenced by luascript_func_call_valist().
void luascript_push_args | ( | struct fc_lua * | fcl, |
int | nargs, | ||
enum api_types * | parg_types, | ||
va_list | args | ||
) |
Push arguments into the Lua stack.
Definition at line 501 of file luascript.c.
Referenced by luascript_callback_invoke(), and luascript_func_call_valist().
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 700 of file luascript.c.
Referenced by script_client_remove_exported_object(), and script_server_remove_exported_object().
Load lua variables from file.
Definition at line 763 of file luascript.c.
Referenced by script_client_vars_load(), and script_server_vars_load().
Save lua variables to file.
Definition at line 737 of file luascript.c.
Referenced by script_client_vars_save(), and script_server_vars_save().