Naev

Module news

Lua bindings to interact with the news.

This will allow you to interact and manipulate the in-game news.

Functions

add (faction, title, body[, date_to_rm[, date]]) Adds an article.
rm (article) Frees an article or a table of articles.
get ([characteristic]) Gets all matching articles in a table.
__eq (a1, a2) Check articles for equality.
title (a) Gets the article title.
desc (a) Gets the article description.
faction (a) Gets the article faction.
date (a) Gets the article date.
bind (a, tag) Tags an article or a table of articles with a string.


Functions

add (faction, title, body[, date_to_rm[, date]])
Adds an article. ( faction, title, body, date_to_rm, date )

Parameters:

  • faction Faction or string of the article, "Generic" for non-factional
  • title string Title of the article
  • body string  What's in the article
  • date_to_rm number or Time date to remove the article (optional)
  • date number or Time What time to put, defaults to current date, use 0 to not use a date (optional)

Returns:

    Article The article matching name or nil if error.

Usage:

  • news.add(faction,title,body,[date_to_rm, [date]])
  • s = news.add( "Empire", "Hello world!", "The Empire wishes to say hello!", 0 ) -- Adds an Empire specific article, with date 0.
rm (article)
Frees an article or a table of articles. ( article )

Parameters:

  • article Article article to free
get ([characteristic])
Gets all matching articles in a table.

characteristic can be any of the following:

  • Title of the articles
  • Body (text) of the articles
  • Faction name of the articles ("Generic" for generic)
  • Tag of the articles (applied with news.bind())
  • Date of the articles in number form

The returned table is populated with all articles matching the specified characteristic. (characteristic)

Parameters:

  • characteristic number or String characteristic to match, or no parameter for all articles (optional)

Returns:

    {Article,...} a table with matching articles
__eq (a1, a2)
Check articles for equality.

Allows you to use the '==' operator in Lua with articles. ( a1, a2 )

Parameters:

  • a1 Article article 1
  • a2 Article article 2

Returns:

    boolean true if both systems are the same.
title (a)
Gets the article title. (a)

Parameters:

  • a Article article to get the title of

Returns:

    string title
desc (a)
Gets the article description. (a)

Parameters:

  • a Article article to get the desc of

Returns:

    string desc
faction (a)
Gets the article faction. (a)

Parameters:

  • a Article article to get the faction of

Returns:

    Faction faction
date (a)
Gets the article date. (a)

Parameters:

  • a Article article to get the date of

Returns:

    number date
bind (a, tag)
Tags an article or a table of articles with a string. (a, tag)

Parameters:

  • a Article Article to bind
  • tag string Tag to bind to the article
generated by LDoc 1.4.6 Last updated 2020-10-01 02:30:07