Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit bac6810

Browse files
protected_function
1 parent fb11042 commit bac6810

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/lua/OFS_LuaExtension.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void OFS_LuaExtension::ShowWindow() noexcept
3838
ImGui::Separator();
3939
}
4040

41-
auto gui = L.get<sol::function>(OFS_LuaExtensions::RenderGui);
41+
auto gui = L.get<sol::protected_function>(OFS_LuaExtensions::RenderGui);
4242
auto res = gui();
4343
if(res.status() != sol::call_status::ok) {
4444
auto err = sol::stack::get_traceback_or_errors(L.lua_state());
@@ -53,7 +53,7 @@ void OFS_LuaExtension::ShowWindow() noexcept
5353
void OFS_LuaExtension::Update() noexcept
5454
{
5555
if(!Active) return;
56-
auto update = L.get<sol::function>(OFS_LuaExtensions::UpdateFunction);
56+
auto update = L.get<sol::protected_function>(OFS_LuaExtensions::UpdateFunction);
5757
auto res = update(ImGui::GetIO().DeltaTime);
5858
if(res.status() != sol::call_status::ok)
5959
{
@@ -150,10 +150,10 @@ bool OFS_LuaExtension::Load() noexcept
150150

151151
try
152152
{
153-
auto res = L.script(extensionText);
153+
auto res = L.safe_script(extensionText);
154154
FUN_ASSERT(res.valid(), "what");
155155

156-
auto init = L.get<sol::function>(OFS_LuaExtensions::InitFunction);
156+
auto init = L.get<sol::protected_function>(OFS_LuaExtensions::InitFunction);
157157
res = init();
158158
if(res.status() != sol::call_status::ok) {
159159
auto err = sol::stack::get_traceback_or_errors(L.lua_state());
@@ -184,7 +184,7 @@ bool OFS_LuaExtension::Load() noexcept
184184

185185
void OFS_LuaExtension::Execute(const std::string& func) noexcept
186186
{
187-
sol::function bind = L[OFS_LuaExtension::BindingTable][func];
187+
sol::protected_function bind = L[OFS_LuaExtension::BindingTable][func];
188188
if(bind.valid()) {
189189
auto res = bind();
190190
if(res.status() != sol::call_status::ok) {
@@ -196,7 +196,7 @@ void OFS_LuaExtension::Execute(const std::string& func) noexcept
196196

197197
void OFS_LuaExtension::ScriptChanged(uint32_t scriptIdx) noexcept
198198
{
199-
sol::function change = L[OFS_LuaExtension::ScriptChangeFunction];
199+
sol::protected_function change = L[OFS_LuaExtension::ScriptChangeFunction];
200200
if(change.valid()) {
201201
auto res = change(scriptIdx + 1);
202202
if(res.status() != sol::call_status::ok) {

0 commit comments

Comments
 (0)