naev 0.12.5
nlua_shiplog.c File Reference

Handles the shiplog Lua bindings. More...

#include "nlua_shiplog.h"
#include "nlua.h"
#include "shiplog.h"
Include dependency graph for nlua_shiplog.c:

Go to the source code of this file.

Functions

int shiplog_loadShiplog (nlua_env env)
static int shiplog_createLog (lua_State *L)
 Bindings for adding log entries to the ship log.
static int shiplog_appendLog (lua_State *L)
 Appends to the shiplog.
int nlua_loadShiplog (nlua_env env)
 Loads the mission Lua library.

Variables

static const luaL_Reg shiplog_methods []

Detailed Description

Handles the shiplog Lua bindings.

Definition in file nlua_shiplog.c.

Function Documentation

◆ nlua_loadShiplog()

int nlua_loadShiplog ( nlua_env env)

Loads the mission Lua library.

Parameters
envLua environment.

Definition at line 30 of file nlua_shiplog.c.

◆ shiplog_appendLog()

int shiplog_appendLog ( lua_State * L)
static

Appends to the shiplog.

Lua usage parameter: shiplog.append("MyLog", "Some message here")

Lua function parameter: string idstr ID string of the log to append to. Lua function parameter: string message Message to append to the log. Lua return parameter: boolean true on success.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: append

Definition at line 94 of file nlua_shiplog.c.

◆ shiplog_createLog()

int shiplog_createLog ( lua_State * L)
static

Bindings for adding log entries to the ship log.

A typical example would be:

shiplog.create( "idstring", "log name", "log type", 0, 0 )
shiplog.append( "idstring", "message to append to log" )

Lua module: shiplog

Creates a shiplog for this mission.

Lua usage parameter: shiplog.create("MyLog", "My mission title", "Mission type") – Creates log "MyLog" without erasing anything Lua usage parameter: shiplog.create("MyOtherLog", "Any title","Anything can be a type", true, 10) – Erases any existing MyOtherLog entries and sets a limit of 10 entries

Lua function parameter: string idstr ID string to identify this log, or empty string for unnamed logsets. Lua function parameter: string logname Name for this log. Lua function parameter: string logtype Type of log (e.g travel, trade, etc, can be anything). Lua function parameter:[opt=false] boolean overwrite Whether to remove previous entries of this logname and type. Lua function parameter:[opt=0] number maxLen Maximum length of the log (zero for infinite) - if greater than this length, new entries appended will result in old entries being removed.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: create

Definition at line 69 of file nlua_shiplog.c.

Variable Documentation

◆ shiplog_methods

const luaL_Reg shiplog_methods[]
static
Initial value:
= {
{ "create", shiplog_createLog },
{ "append", shiplog_appendLog },
{ 0, 0 } }
static int shiplog_appendLog(lua_State *L)
Appends to the shiplog.
static int shiplog_createLog(lua_State *L)
Bindings for adding log entries to the ship log.

Shiplog Lua methods.

Definition at line 18 of file nlua_shiplog.c.