![]() |
naev 0.12.5
|
Handles creating and setting up basic Lua environments. More...
#include "nlua.h"#include "array.h"#include "cmark_wrap.h"#include "conf.h"#include "console.h"#include "debug.h"#include "log.h"#include "lua_enet.h"#include "lutf8lib.h"#include "lyaml.h"#include "ndata.h"#include "nlua_audio.h"#include "nlua_cli.h"#include "nlua_commodity.h"#include "nlua_data.h"#include "nlua_diff.h"#include "nlua_faction.h"#include "nlua_file.h"#include "nlua_jump.h"#include "nlua_linopt.h"#include "nlua_naev.h"#include "nlua_news.h"#include "nlua_outfit.h"#include "nlua_pilot.h"#include "nlua_player.h"#include "nlua_rnd.h"#include "nlua_safelanes.h"#include "nlua_shiplog.h"#include "nlua_spfx.h"#include "nlua_spob.h"#include "nlua_system.h"#include "nlua_time.h"#include "nlua_var.h"#include "nlua_vec2.h"#include "nluadef.h"#include "nstring.h"
Go to the source code of this file.
Data Structures | |
| struct | LuaCache_t |
| Cache structure for loading chunks. More... | |
Functions | |
| static int | nlua_package_preload (lua_State *L) |
| static int | nlua_package_loader_lua (lua_State *L) |
| load( string module ) – searcher function to replace package.loaders[2] (Lua 5.1), i.e., for Lua modules. | |
| static int | nlua_package_loader_c (lua_State *L) |
| load( string module ) – searcher function to replace package.loaders[3] (Lua 5.1), i.e., for C modules. | |
| static int | nlua_package_loader_croot (lua_State *L) |
| load( string module ) – searcher function to replace package.loaders[4] (Lua 5.1), i.e., for C packages. | |
| static int | nlua_require (lua_State *L) |
| include( string module ) | |
| static lua_State * | nlua_newState (void) |
| Wrapper around luaL_newstate. | |
| static int | nlua_loadBasic (lua_State *L) |
| Loads specially modified basic stuff. | |
| static int | luaB_loadstring (lua_State *L) |
| Replacement for the internal Lua loadstring(). | |
| static int | lua_cache_cmp (const void *p1, const void *p2) |
| Compares two Lua caches. | |
| static int | nlua_errTraceInternal (lua_State *L, int idx) |
| static int | nlua_gettext (lua_State *L) |
| gettext support. | |
| static int | nlua_ngettext (lua_State *L) |
| gettext support for singular and plurals. | |
| static int | nlua_pgettext (lua_State *L) |
| gettext support with context. | |
| static int | nlua_gettext_noop (lua_State *L) |
| gettext support (noop). Does not actually do anything, but gets detected by gettext. | |
| static int | nlua_log2 (lua_State *L) |
| Implements the Lua function math.log2 (base-2 logarithm). | |
| static int | nlua_os_getenv (lua_State *L) |
| Implements the Lua function os.getenv. In the sandbox we only make a fake $HOME visible. | |
| static int | nlua_panic (lua_State *L) |
| Handles what to do when Lua panics. | |
| void | lua_init (void) |
| void | lua_exit (void) |
| int | nlua_warn (lua_State *L, int idx) |
| void | lua_clearCache (void) |
| Clears the cached stuff. | |
| int | nlua_dobufenv (nlua_env env, const char *buff, size_t sz, const char *name) |
| int | nlua_dofileenv (nlua_env env, const char *filename) |
| int | nlua_dochunkenv (nlua_env env, int chunk, const char *name) |
| nlua_env | nlua_newEnv (const char *name) |
| void | nlua_freeEnv (nlua_env env) |
| void | nlua_pushenv (lua_State *L, nlua_env env) |
| void | nlua_getenv (lua_State *L, nlua_env env, const char *name) |
| void | nlua_setenv (lua_State *L, nlua_env env, const char *name) |
| void | nlua_register (nlua_env env, const char *libname, const luaL_Reg *l, int metatable) |
| int | nlua_loadStandard (nlua_env env) |
| Loads the standard Naev Lua API. | |
| int | nlua_errTrace (lua_State *L) |
| Gets a trace from Lua. | |
| int | nlua_pcall (nlua_env env, int nargs, int nresults) |
| int | nlua_refenv (nlua_env env, const char *name) |
| Gets the reference of a global in a lua environment. | |
| int | nlua_refenvtype (nlua_env env, const char *name, int type) |
| Gets the reference of a global in a lua environment if it matches a type. | |
| int | nlua_reffield (int objref, const char *name) |
| Gets the reference to the specified field from an object reference. | |
| int | nlua_ref (lua_State *L, int idx) |
| Creates a new reference to a Lua structure at a position. | |
| void | nlua_unref (lua_State *L, int idx) |
| Removes a reference set with nlua_ref. | |
| void | nlua_resize (void) |
| Propagates a resize event to all the environments forcibly. | |
| int | nlua_helperTags (lua_State *L, int idx, char *const *tags) |
| Helper function to deal with tags. | |
Variables | |
| lua_State * | naevL = NULL |
| nlua_env | __NLUA_CURENV = LUA_NOREF |
| static char * | common_script |
| static size_t | common_sz |
| static int | nlua_envs = LUA_NOREF |
| static LuaCache_t * | lua_cache = NULL |
| static const luaL_Reg | gettext_methods [] |
| static const lua_CFunction | loaders [] |
Handles creating and setting up basic Lua environments.
Definition in file nlua.c.
|
static |
|
static |
| int nlua_dobufenv | ( | nlua_env | env, |
| const char * | buff, | ||
| size_t | sz, | ||
| const char * | name ) |
| int nlua_dochunkenv | ( | nlua_env | env, |
| int | chunk, | ||
| const char * | name ) |
| void nlua_getenv | ( | lua_State * | L, |
| nlua_env | env, | ||
| const char * | name ) |
|
static |
|
static |
gettext support (noop). Does not actually do anything, but gets detected by gettext.
Lua usage parameter: N_( str ) Lua function parameter: str String to gettext on. Lua return parameter: The string converted to gettext.
| L | Lua State |
Lua function: gettext_noop
| int nlua_helperTags | ( | lua_State * | L, |
| int | idx, | ||
| char *const * | tags ) |
|
static |
| int nlua_loadStandard | ( | nlua_env | env | ) |
|
static |
|
static |
|
static |
gettext support for singular and plurals.
Lua usage parameter: ngettext( msgid1, msgid2, n ) Lua function parameter: msgid1 Singular form. Lua function parameter: msgid2 Plural form. Lua function parameter: n Number of elements. Lua return parameter: The string converted to gettext.
| L | Lua State |
Lua function: ngettext
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
gettext support with context.
Lua usage parameter: pgettext( context, msg ) Lua function parameter: context Context of the message. Lua function parameter: msg Message to translate. Lua return parameter: The string converted to gettext.
| L | Lua State |
Lua function: pgettext
| int nlua_ref | ( | lua_State * | L, |
| int | idx ) |
| int nlua_refenv | ( | nlua_env | env, |
| const char * | name ) |
| int nlua_refenvtype | ( | nlua_env | env, |
| const char * | name, | ||
| int | type ) |
| int nlua_reffield | ( | int | objref, |
| const char * | name ) |
| void nlua_register | ( | nlua_env | env, |
| const char * | libname, | ||
| const luaL_Reg * | l, | ||
| int | metatable ) |
|
static |
| void nlua_resize | ( | void | ) |
| void nlua_setenv | ( | lua_State * | L, |
| nlua_env | env, | ||
| const char * | name ) |
| void nlua_unref | ( | lua_State * | L, |
| int | idx ) |
|
static |
|
static |
Vector metatable methods.
|
static |
Our loaders.
|
static |