![]() |
naev 0.12.5
|
Lua news module. More...
#include "nlua_news.h"#include "array.h"#include "land.h"#include "news.h"#include "nlua_time.h"#include "nluadef.h"#include "ntime.h"
Go to the source code of this file.
Functions | |
| static news_t * | luaL_validnews (lua_State *L, int ind) |
| Makes sure the news is valid or raises a Lua error. | |
| static int | lua_isnews (lua_State *L, int ind) |
| Checks to see if ind is a news. | |
| static LuaNews_t * | lua_pushnews (lua_State *L, LuaNews_t news) |
| Pushes a news on the stack. | |
| static int | newsL_add (lua_State *L) |
| Lua bindings to interact with the news. | |
| static int | newsL_rm (lua_State *L) |
| Frees a news article or a table of articles. Lua function parameter: News n News article to free. | |
| static int | newsL_get (lua_State *L) |
| Gets all matching news articles in a table. | |
| static int | newsL_eq (lua_State *L) |
| Check news articles for equality. | |
| static int | newsL_title (lua_State *L) |
| Gets the news article title. Lua function parameter: Article a article to get the title of Lua return parameter: string title. | |
| static int | newsL_desc (lua_State *L) |
| Gets the news article description. Lua function parameter: Article a article to get the desc of Lua return parameter: string desc. | |
| static int | newsL_faction (lua_State *L) |
| Gets the news article faction. Lua function parameter: Article a article to get the faction of Lua return parameter: Faction faction. | |
| static int | newsL_date (lua_State *L) |
| Gets the news article date. Lua function parameter: Article a article to get the date of Lua return parameter: number date. | |
| static int | newsL_bind (lua_State *L) |
| Tags a news article or a table of articles with a string. Lua function parameter: Article a Article to bind Lua function parameter: string tag Tag to bind to the article. | |
| int | nlua_loadNews (nlua_env env) |
| Loads the news library. | |
| LuaNews_t * | lua_tonews (lua_State *L, int ind) |
| Gets news at index. | |
| LuaNews_t * | luaL_checknews (lua_State *L, int ind) |
| Gets news at index or raises error if there is no news at index. | |
Variables | |
| news_t * | news_list |
| int | land_loaded |
| static const luaL_Reg | news_methods [] |
Lua news module.
Definition in file nlua_news.c.
|
static |
Checks to see if ind is a news.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 105 of file nlua_news.c.
|
static |
Pushes a news on the stack.
| L | Lua state to push news into. |
| news | News to push. |
Definition at line 90 of file nlua_news.c.
| LuaNews_t * lua_tonews | ( | lua_State * | L, |
| int | ind ) |
Gets news at index.
| L | Lua state to get news from. |
| ind | Index position to find the news. |
Definition at line 65 of file nlua_news.c.
| LuaNews_t * luaL_checknews | ( | lua_State * | L, |
| int | ind ) |
Gets news at index or raises error if there is no news at index.
| L | Lua state to get news from. |
| ind | Index position to find news. |
Definition at line 76 of file nlua_news.c.
|
static |
Makes sure the news is valid or raises a Lua error.
| L | State currently running. |
| ind | Index of the news to validate. |
Definition at line 128 of file nlua_news.c.
|
static |
Lua bindings to interact with the news.
This will allow you to interact and manipulate the in-game news.
Lua module: news
Adds a news article. Lua usage parameter: news.add(faction,title,body,[date_to_rm, [date]])
Lua usage parameter: s = news.add( "Empire", "Hello world!", "The Empire wishes to say hello!", 0 ) – Adds an Empire specific article, with date 0. Lua usage parameter: s = news.add( { { faction = "Empire", title = "Hello World!", body = "The Empire wishes to say hello!" } } ) – Can also be passed as tables
Lua function parameter: Faction|string faction of the article, "Generic" for non-factional Lua function parameter: string title Title of the article Lua function parameter: string body What's in the article Lua function parameter:[opt] number|Time date_to_rm date to remove the article Lua function parameter:[opt] number|Time date What time to put, defaults to current date, use 0 to not use a date Lua function parameter:[opt=5] number Priority to use. Lower is more important and will appear first. Lua return parameter: Article The article matching name or nil if error.
| L | Lua State |
Lua function: add
Definition at line 165 of file nlua_news.c.
|
static |
Tags a news article or a table of articles with a string. Lua function parameter: Article a Article to bind Lua function parameter: string tag Tag to bind to the article.
| L | Lua State |
Lua function: bind
Definition at line 460 of file nlua_news.c.
|
static |
Gets the news article date. Lua function parameter: Article a article to get the date of Lua return parameter: number date.
| L | Lua State |
Lua function: date
Definition at line 447 of file nlua_news.c.
|
static |
Gets the news article description. Lua function parameter: Article a article to get the desc of Lua return parameter: string desc.
| L | Lua State |
Lua function: desc
Definition at line 421 of file nlua_news.c.
|
static |
Check news articles for equality.
Allows you to use the '==' operator in Lua with articles.
Lua function parameter: Article a1 article 1 Lua function parameter: Article a2 article 2 Lua return parameter: boolean true if both systems are the same.
| L | Lua State |
Lua function: __eq
Definition at line 393 of file nlua_news.c.
|
static |
Gets the news article faction. Lua function parameter: Article a article to get the faction of Lua return parameter: Faction faction.
| L | Lua State |
Lua function: faction
Definition at line 434 of file nlua_news.c.
|
static |
Gets all matching news articles in a table.
characteristic can be any of the following:
The returned table is populated with all articles matching the specified characteristic.
Lua function parameter:[opt] number|String characteristic characteristic to match, or no parameter for all articles Lua return parameter: {Article,...} a table with matching articles
| L | Lua State |
Lua function: get
Definition at line 343 of file nlua_news.c.
|
static |
Frees a news article or a table of articles. Lua function parameter: News n News article to free.
| L | Lua State |
Lua function: rm
Definition at line 299 of file nlua_news.c.
|
static |
Gets the news article title. Lua function parameter: Article a article to get the title of Lua return parameter: string title.
| L | Lua State |
Lua function: title
Definition at line 408 of file nlua_news.c.
| int nlua_loadNews | ( | nlua_env | env | ) |
Loads the news library.
| env | Environment to load news library into. |
Definition at line 52 of file nlua_news.c.
|
extern |
|
static |
News metatable methods.
Definition at line 39 of file nlua_news.c.