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[, Priority=5]]]) Adds a news article.
rm (n) Frees a news article or a table of articles.
get ([characteristic]) Gets all matching news articles in a table.
__eq (a1, a2) Check news articles for equality.
title (a) Gets the news article title.
desc (a) Gets the news article description.
faction (a) Gets the news article faction.
date (a) Gets the news article date.
bind (a, tag) Tags a news article or a table of articles with a string.


Functions

add (faction, title, body[, date_to_rm[, date[, Priority=5]]])
Adds a news article.

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)
  • Priority number to use. Lower is more important and will appear first. (default 5)

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.
    
  • s = news.add( { { faction = "Empire", title = "Hello World!", body =
    "The Empire wishes to say hello!" } } ) -- Can also be passed as tables
    
rm (n)
Frees a news article or a table of articles.

Parameters:

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

characteristic can be any of the following:

  • Title of the news 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.

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 news articles for equality.

Allows you to use the '==' operator in Lua with articles.

Parameters:

  • a1 Article article 1
  • a2 Article article 2

Returns:

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

Parameters:

  • a Article article to get the title of

Returns:

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

Parameters:

  • a Article article to get the desc of

Returns:

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

Parameters:

  • a Article article to get the faction of

Returns:

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

Parameters:

  • a Article article to get the date of

Returns:

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

Parameters:

  • a Article Article to bind
  • tag string Tag to bind to the article
generated by LDoc 1.5.0 Last updated 2024-04-19 15:38:17