feat(scripting): forward declare luastate (#11418) a08d538dbf

Fixes an issue when building runtimes with scripting enabled where
certain headers may not be included

Co-authored-by: David Skuza <david@rive.app>
This commit is contained in:
philter
2026-01-09 18:55:55 +00:00
parent 35eb312314
commit c851859aa3
4 changed files with 6 additions and 7 deletions

View File

@@ -1 +1 @@
3734dc3ab996c24c024129cb5f88d257f241074d
a08d538dbf15a1f997108de82b626df71226d271

View File

@@ -24,6 +24,7 @@ enum ScriptProtocol
};
#ifdef WITH_RIVE_SCRIPTING
class LuaState;
class ScriptAssetImporter;
#endif
@@ -61,7 +62,9 @@ private:
int m_implementedMethods = 0;
protected:
#ifdef WITH_RIVE_SCRIPTING
bool verifyImplementation(ScriptedObject* object, LuaState* luaState);
#endif
public:
int implementedMethods() { return m_implementedMethods; }

View File

@@ -6,7 +6,6 @@
#include "rive/factory.hpp"
#include "rive/file_asset_loader.hpp"
#include "rive/assets/manifest_asset.hpp"
#include "rive/lua/lua_state.hpp"
#include "rive/viewmodel/data_enum.hpp"
#include "rive/viewmodel/viewmodel_component.hpp"
#include "rive/viewmodel/viewmodel_instance.hpp"
@@ -40,6 +39,7 @@ class BindableArtboard;
#ifdef WITH_RIVE_SCRIPTING
class CPPRuntimeScriptingContext;
class ScriptingVM;
class LuaState;
#endif
///

View File

@@ -43,10 +43,10 @@ ScriptInput* ScriptInput::from(Core* component)
void ScriptInput::initScriptedValue() {}
#ifdef WITH_RIVE_SCRIPTING
bool OptionalScriptedMethods::verifyImplementation(ScriptedObject* object,
LuaState* luaState)
{
#ifdef WITH_RIVE_SCRIPTING
auto state = luaState->state;
lua_pushvalue(state, -1);
if (static_cast<lua_Status>(rive_lua_pcall(state, 0, 1)) != LUA_OK)
@@ -144,12 +144,8 @@ bool OptionalScriptedMethods::verifyImplementation(ScriptedObject* object,
}
rive_lua_pop(state, 1);
return true;
#else
return false;
#endif
}
#ifdef WITH_RIVE_SCRIPTING
LuaState* ScriptAsset::vm()
{
if (m_file == nullptr)