Module PtUtil

Utility functions.

Functions

class (...) Creates a new class with the specified superclass(es).
drawLine (p1, p2, color, width) Draws a line.
drawRect (rect, color, width) Draws a rectangle.
drawText (text, options, fontSize, color) Draw the text string, offsetting the string to account for leading whitespace.
fillRect (rect, color) Fills a rectangle.
getFontScale (size) Gets the scale of the specified font size.
getKey (key, shift, capslock) Gets a string representation of the keycode.
getStringWidth (text, fontSize) Get the approximate pixel width of a string.
library () Get a list of all lua scripts in the PenguinGUI library.
removeObject (t, o) Removes the first occurence of an object from the given table.
ripairs (t) Does the same thing as ipairs, except backwards


Functions

class (...)
Creates a new class with the specified superclass(es).

Parameters:

  • ... The new class's superclass(es).
drawLine (p1, p2, color, width)
Draws a line.

All parameters are identical to those of console.canvasDrawLine

Parameters:

  • p1
  • p2
  • color
  • width
drawRect (rect, color, width)
Draws a rectangle.

All parameters are identical to those of console.canvasDrawRect

Parameters:

  • rect
  • color
  • width
drawText (text, options, fontSize, color)
Draw the text string, offsetting the string to account for leading whitespace.

All parameters are identical to those of console.canvasDrawText

Parameters:

  • text
  • options
  • fontSize
  • color Convert to pixels
fillRect (rect, color)
Fills a rectangle.

All parameters are identical to those of console.canvasDrawRect

Parameters:

  • rect
  • color
getFontScale (size)
Gets the scale of the specified font size.

Parameters:

  • size The font size to get the scale for.
getKey (key, shift, capslock)
Gets a string representation of the keycode.

Parameters:

  • key The keycode of the key.
  • shift Boolean representing whether or not shift is pressed.
  • capslock Boolean representing whether or not capslock is on.
getStringWidth (text, fontSize)
Get the approximate pixel width of a string.

Parameters:

  • text The string to get the width of.
  • fontSize The size of the font to get the width from.
library ()
Get a list of all lua scripts in the PenguinGUI library.

Returns:

    A list of strings containing the paths to the PenguinGUI scripts.
removeObject (t, o)
Removes the first occurence of an object from the given table.

Parameters:

  • t The table to remove from.
  • o The object to remove.

Returns:

    The index of the removed object, or -1 if the object was not found.
ripairs (t)
Does the same thing as ipairs, except backwards

Parameters:

  • t The table to iterate backwards over
generated by LDoc 1.4.3 Last updated 2015-02-10 07:20:59