mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 00:07:58 +03:00
27 lines
668 B
C++
27 lines
668 B
C++
#include "frameworkandsol.h"
|
|
#include "ScriptInterfaceState.h"
|
|
#include "GameLogicScript.h"
|
|
#include "GameFlowScript.h"
|
|
|
|
sol::state g_solState;
|
|
|
|
int lua_exception_handler(lua_State* L, sol::optional<std::exception const &> maybe_exception, sol::string_view description)
|
|
{
|
|
return luaL_error(L, description.data());
|
|
}
|
|
|
|
ScriptInterfaceGame* ScriptInterfaceState::CreateGame()
|
|
{
|
|
return new GameScript(&g_solState);
|
|
}
|
|
|
|
ScriptInterfaceFlow* ScriptInterfaceState::CreateFlow()
|
|
{
|
|
return new GameFlow(&g_solState);
|
|
}
|
|
|
|
void ScriptInterfaceState::Init()
|
|
{
|
|
g_solState.open_libraries(sol::lib::base, sol::lib::math);
|
|
g_solState.set_exception_handler(lua_exception_handler);
|
|
}
|