Global Variables
OOP Helpers
RollingQuest extends Lua with a lightweight class system. You define classes withclass(), create instances with new(), and introspect the class hierarchy with classof() and instanceof().
class
Creates and returns a new table configured to act as a class. You can optionally inherit from an existing class by passing it as the second argument.
new
Creates a new instance of class, wires up the prototype chain, and calls the constructor (__init by convention) if one is defined, passing args through.
rawnew
Like new but skips the constructor call. Use this inside a constructor to create the raw instance before initialising fields manually.
baseclass
Returns the base class that class inherits from, or nil if it has none.
classof
Returns the class of a value. For class instances it returns the class table; for primitive Lua types it returns a string with the type name ("number", "string", etc.).
instanceof
Returns true if value is an instance of type or any subclass of it. You can also pass a string type name to check primitive types.
Complete class definition example
Script Loading
RollingQuest provides three functions for bringing external scripts into a running script. Each has distinct semantics, so choose the right one for your use case.import
Loads the script scriptName, executes it in its own isolated scope, and returns its globals as a table. Use import when you want a clean namespace and to avoid polluting the current scope.
include
Loads the script scriptName and merges its globals directly into the current script’s scope. Think of it like a textual paste — all the names the loaded script defines become available as if you had written them yourself.
require
Loads the module in scriptName. If that script returns a value (a table, class, or anything else), require passes that value back to the caller. This mirrors standard Lua module conventions and is the right choice for library-style scripts.
Standard Functions
Output and errors
Type inspection and conversion
Table iteration
Metatables and raw access
Standard Library Highlights
math
The math namespace exposes the standard Lua math library. Key constants and functions:
string
String functions are available both on the string table and as methods on any string value.