OpenBlox
A game engine which provides a simple and easy to learn Lua API.
OB::Lua Namespace Reference

Classes

struct  OBLState
 

Functions

lua_State * initGlobal (OBEngine *eng)
 
OBEnginegetEngine (lua_State *L)
 
lua_State * initThread (lua_State *gL)
 
lua_State * initCoroutine (lua_State *pL)
 
void close_state (lua_State *L)
 
bool getsPaused (lua_State *L)
 
void setGetsPaused (lua_State *L, bool getsPaused)
 
bool isDMBound (lua_State *L)
 
void setDMBound (lua_State *L, bool dmBound)
 
std::string handle_errors (lua_State *L)
 
int lua_print (lua_State *L)
 
int lua_warn (lua_State *L)
 
int lua_wait (lua_State *L)
 
int lua_delay (lua_State *L)
 
int lua_spawn (lua_State *L)
 
int lua_newInstance (lua_State *L)
 
int lua_newColor3 (lua_State *L)
 
int lua_Color3FromRGB (lua_State *L)
 
int lua_newVector3 (lua_State *L)
 
int lua_newVector2 (lua_State *L)
 
int lua_newCFrame (lua_State *L)
 
int lua_newUDim (lua_State *L)
 
int lua_newUDim2 (lua_State *L)
 
int lua_listInstanceClasses (lua_State *L)
 
int luaopen_obbase (lua_State *L)
 
int luaopen_obos (lua_State *L)
 

Function Documentation

◆ close_state()

void OB::Lua::close_state ( lua_State *  L)

Handles closing a state.

Parameters
LLua state
Author
John M. Harris, Jr.

◆ getEngine()

OBEngine* OB::Lua::getEngine ( lua_State *  L)

Returns the OBEngine* associated with this Lua state.

Returns
OBEngine* engine
Author
John M. Harris, Jr.

◆ getsPaused()

bool OB::Lua::getsPaused ( lua_State *  L)

Gets whether or not a Lua state gets paused.

Parameters
LLua state
Returns
bool
Author
John M. Harris, Jr.

◆ handle_errors()

std::string OB::Lua::handle_errors ( lua_State *  L)

Used internally to handle errors. Returns a Lua error as a string.

Parameters
LLua state
Returns
std::string Lua error message
Author
John M. Harris, Jr.

◆ initCoroutine()

lua_State* OB::Lua::initCoroutine ( lua_State *  pL)

Returns a Lua state under a parent Lua state. This replaces Lua's default coroutine creation, because OpenBlox needs to keep track of certain metadata about each Lua state, for example the 'script' value. Event handlers are also passed through this.

Parameters
pLParent Lua state
Returns
New Lua state under the parent Lua state
Author
John M. Harris, Jr.

◆ initGlobal()

lua_State* OB::Lua::initGlobal ( OBEngine eng)

Returns a global Lua state, which is only used to handle global variables and state management (i.e. though the TaskScheduler).

Returns
Global a global Lua state.
Author
John M. Harris, Jr.

◆ initThread()

lua_State* OB::Lua::initThread ( lua_State *  gL)

Returns a Lua state under the global Lua state with the altered OpenBlox standard library. OpenBlox provides an altered base library, coroutine library and os library. The other libraries loaded are as follows: table, string, math, utf8

Parameters
gLGlobal Lua state
Returns
Lua state under the global Lua state
Author
John M. Harris, Jr.

◆ isDMBound()

bool OB::Lua::isDMBound ( lua_State *  L)

Gets whether or not a Lua state is DM bound.

Parameters
LLua state
Returns
bool
Author
John M. Harris, Jr.

◆ lua_Color3FromRGB()

int OB::Lua::lua_Color3FromRGB ( lua_State *  L)

Used to create a Color3 using RGB integer values from Lua.

Parameters
LLua state
Returns
int 1
Author
Tochigi

◆ lua_delay()

int OB::Lua::lua_delay ( lua_State *  L)

Used to run a Lua function in another coroutine after a certain amount of time.

Parameters
LLua state
Returns
int 0
Author
John M. Harris, Jr.

◆ lua_listInstanceClasses()

int OB::Lua::lua_listInstanceClasses ( lua_State *  L)

Used to get a list of all Instance classes from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newCFrame()

int OB::Lua::lua_newCFrame ( lua_State *  L)

Used to create a CFrame from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newColor3()

int OB::Lua::lua_newColor3 ( lua_State *  L)

Used to create a Color3 from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newInstance()

int OB::Lua::lua_newInstance ( lua_State *  L)

Used to create an Instance from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newUDim()

int OB::Lua::lua_newUDim ( lua_State *  L)

Used to create a UDim from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newUDim2()

int OB::Lua::lua_newUDim2 ( lua_State *  L)

Used to create a UDim2 from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newVector2()

int OB::Lua::lua_newVector2 ( lua_State *  L)

Used to create a Vector2 from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_newVector3()

int OB::Lua::lua_newVector3 ( lua_State *  L)

Used to create a Vector3 from Lua.

Parameters
LLua state
Returns
int 1
Author
John M. Harris, Jr.

◆ lua_print()

int OB::Lua::lua_print ( lua_State *  L)

Used as the redefined "print" function for Lua.

Parameters
LLua state
Returns
int 0
Author
John M. Harris, Jr.

◆ lua_spawn()

int OB::Lua::lua_spawn ( lua_State *  L)

Used to run a Lua function in another coroutine as soon as possible.

Parameters
LLua state
Returns
int 0
Author
John M. Harris, Jr.

◆ lua_wait()

int OB::Lua::lua_wait ( lua_State *  L)

Used to yield the current coroutine for a certain amount of time.

Parameters
LLua state
Returns
int 0
Author
John M. Harris, Jr.

◆ lua_warn()

int OB::Lua::lua_warn ( lua_State *  L)

Basic warn function.

Parameters
LLua state
Returns
int 0
Author
John M. Harris, Jr.

◆ luaopen_obbase()

int OB::Lua::luaopen_obbase ( lua_State *  L)

◆ luaopen_obos()

int OB::Lua::luaopen_obos ( lua_State *  L)

◆ setDMBound()

void OB::Lua::setDMBound ( lua_State *  L,
bool  dmBound 
)

Gets whether or not a Lua state is DM bound.

Parameters
LLua state
dmBoundDM Bound
Author
John M. Harris, Jr.

◆ setGetsPaused()

void OB::Lua::setGetsPaused ( lua_State *  L,
bool  getsPaused 
)

Gets whether or not a Lua state gets paused.

Parameters
LLua state
getsPausedWhether or not this state gets paused
Author
John M. Harris, Jr.