mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 08:17:59 +03:00
Add ScriptInterfaceFlow and ScriptInterfaceState. Add references.
This commit is contained in:
parent
b59b7e4a1c
commit
4429bd8aa2
6 changed files with 82 additions and 3 deletions
27
Scripting/src/ScriptInterfaceState.cpp
Normal file
27
Scripting/src/ScriptInterfaceState.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue