2022-01-25 23:50:12 +00:00
|
|
|
#include "frameworkandsol.h"
|
|
|
|
#include "ScriptInterfaceState.h"
|
|
|
|
#include "GameLogicScript.h"
|
|
|
|
#include "GameFlowScript.h"
|
2022-02-02 20:04:14 +00:00
|
|
|
#include "Entities/Entities.h"
|
2022-01-25 23:50:12 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-02-02 23:51:44 +00:00
|
|
|
ScriptInterfaceEntities* ScriptInterfaceState::CreateEntities()
|
2022-02-02 19:49:57 +00:00
|
|
|
{
|
|
|
|
return new GameEntities(&g_solState);
|
|
|
|
}
|
|
|
|
|
2022-01-25 23:50:12 +00:00
|
|
|
void ScriptInterfaceState::Init()
|
|
|
|
{
|
|
|
|
g_solState.open_libraries(sol::lib::base, sol::lib::math);
|
|
|
|
g_solState.set_exception_handler(lua_exception_handler);
|
|
|
|
}
|
2022-02-02 19:49:57 +00:00
|
|
|
|