Rainmeter Snippets

This is a collection of useful "snippets" of Lua script code for users of Rainmeter, a desktop customization tool for Windows. It is maintained by the Rainmeter development team, and hosted on GitHub.


  • Deliminate
    A function that separates a string into parts by a given delimiter.

  • SortRandom
    A function that sorts a given table into a random order.

  • Switch
    A function that emulates a switch statement.

  • MinValue / MaxValue
    A function that returns the minimum or maximum numeric or alphabetical value of a set.


File Input & Output

  • Read & Write a File
    Functions that read and write any string to or from a text file.

  • Read INI
    A function that parses an INI formatted text file into a table, with the structure Table[Section][Parameter] = Value.

  • Write INI
    A function that writes an INI formatted text file from a given table, with the structure Table[Section][Parameter] = Value.


  • Add Commas
    Returns an input number as a string formatted with commas.

  • Add Suffix
    Returns the ordinal suffix for an input number.

  • AutoScale
    A function that scales a number of bytes, with an optional number of decimal places. Returns a second string value with the scale suffix.

  • Average
    A function that averages a list of numbers.

  • Round
    Rounds a number (num) to any optional number of decimal places (idp)

  • Clamp
    Constrains a number between low and high values.


  • Detect Value Change
    A simple method for "watching" a data value in the skin (variable, measure or option) and taking action when the value changes.

  • Nested Expressions
    A method for parsing a string with nested expressions such as variables (i.e. {SomeVariable{SomethingElse}}).

  • Set Meter & Measure Options
    A simple method for setting multiple options on the same meter or measure.



  • Parse File Path
    A function that breaks down a file or folder path and returns the components as a table.
  • Change Case
    A set of function to change a string to either Sentence Case or Title Case.