CorsixTH engine (the C++ part)
Open source implementation of Theme Hospital
Loading...
Searching...
No Matches
Functions
main.cpp File Reference
#include "config.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <string>
#include <string_view>
#include "lua.hpp"
#include "lua_rnc.h"
#include "lua_sdl.h"
#include "persist_lua.h"
#include "th_lua.h"

Functions

int luaopen_random (lua_State *L)
 
int lua_init_no_eval (lua_State *L)
 Alternative lua mode entry point.
 
int lua_init (lua_State *L)
 Lua mode entry point.
 
int lua_stacktrace (lua_State *L)
 Process a caught error before returning it to the caller.
 
int lua_panic (lua_State *L)
 Process an uncaught Lua error before aborting.
 

Function Documentation

◆ lua_init()

int lua_init ( lua_State L)

Lua mode entry point.

Performs initialization tasks for setting up the lua environment, and then calls the main lua entry point: CorsixTH.lua or an alternative script passed in via the command line.

See also
lua_init_no_eval

◆ lua_init_no_eval()

int lua_init_no_eval ( lua_State L)

Alternative lua mode entry point.

Performs initialization tasks for setting up the lua environment, including preloading libraries and registering C functions; verifying the lua runtime version matches; and preparing the stack to call CorsixTH.lua or an alternate Lua entry script passed via the command line.

◆ lua_panic()

int lua_panic ( lua_State L)

Process an uncaught Lua error before aborting.

Lua errors shouldn't occur outside of protected mode, and there isn't much which can be done when they do, but at least the user should be informed, and the error message printed.

◆ lua_stacktrace()

int lua_stacktrace ( lua_State L)

Process a caught error before returning it to the caller.

Processing of the error message is done here so that a stack trace can be added before the stack is unwound, and so that if an error occurs while processing the error, the caller receives LUA_ERRERR rather than panicking while processing it itself.

◆ luaopen_random()

int luaopen_random ( lua_State L)