Module game_data_lua.rslib

The renderscript library is defined by a Lua file within your Dual Universe installation, view it at: ...\Dual Universe\Game\data\lua\rslib.lua

To use it, simply import it using:

local rslib = require('rslib')

then call methods as:

rslib.drawQuickText("Hello World")

Functions

drawQuickImage (url) Draw a full-screen image loaded from the given url.
drawQuickText (text, options) Draw a string of text with line breaks and word wrapping in the center of the screen.
drawRenderCost () Draw a small render cost profiler at the bottom-left of the screen to show the current render cost of the screen versus the maximum allowed cost.
getTextWrapped (font, text, maxWidth) Break the given text into a table of strings such that each element takes no more than maxWidth horizontal pixels when rendered with the given font.
drawGrid (size, opacity) Draw a grid on the screen.
print (...) Like Lua print, but uses renderScript.logMessage to print to the in-game Lua chat window.
pprint (...) Pretty print, like print, except using toString to see tables.
toString (x) Like Lua tostring, but recursively stringifies tables.


Functions

drawQuickImage (url)
Draw a full-screen image loaded from the given url.

Parameters:

  • url string The url to load the image from.
drawQuickText (text, options)
Draw a string of text with line breaks and word wrapping in the center of the screen. Options may contain any of the following:
  • textColor (table) Four-component RGBA table; e.g. red is {1, 0, 0, 1}.
  • bgColor (table) Three-component RGB table for background color.
  • fontName (string) Name of font (see render script docs).
  • fontSize (int) Size of font, in vertical pixels.
  • lineSpacing (float) Spacing from one baseline to the next.
  • wrapWidth (float) Total width of the text region, as a fraction of screen width.
  • Parameters:

    • text string The text to display.
    • options table The options to use.
drawRenderCost ()
Draw a small render cost profiler at the bottom-left of the screen to show the current render cost of the screen versus the maximum allowed cost.

NOTE: displays render cost at the time of the function call, so you must call at the end of your script to see the total cost!

getTextWrapped (font, text, maxWidth)
Break the given text into a table of strings such that each element takes no more than maxWidth horizontal pixels when rendered with the given font.

Parameters:

  • font int The id of the font to use.
  • text string The text to split.
  • maxWidth float The max number of horizontal pixels before the string is split onto another line.
drawGrid (size, opacity)
Draw a grid on the screen.

Parameters:

  • size float The size of the grid square.
  • opacity float The opacity of the grid lines [0..1].
print (...)
Like Lua print, but uses renderScript.logMessage to print to the in-game Lua chat window.

NOTE: Only visible if 'enable logging' is on for this screen!

Parameters:

  • ... The items to print.
pprint (...)
Pretty print, like print, except using toString to see tables.

Parameters:

  • ... The items to print.
toString (x)
Like Lua tostring, but recursively stringifies tables.

Parameters:

  • x The item to print.
generated by LDoc 1.5.0 Last updated 2024-09-27 15:22:47