Files
fs2open.github.com/code/scpui/RocketLuaSystemInterface.h
asarium 9d9083ab52 Give Lua libRockets documents their own environment
This gives every document their own environment instead of using the
global environment. Previously it was necessary to store variables in
the global namespace since otherwise they could not be accessed by event
listeners.

This creates a separate environment table for every document so that all
<script> blocks and event handlers share the same "global" environment.
2020-09-21 21:07:00 +02:00

29 lines
682 B
C++

#pragma once
#include "globalincs/pstypes.h"
// Our Assert conflicts with the definitions inside libRocket
#pragma push_macro("Assert")
#undef Assert
#include <Rocket/Core/Element.h>
#include <Rocket/Core/Lua/LuaSystemInterface.h>
#pragma pop_macro("Assert")
namespace scpui {
class RocketLuaSystemInterface : public Rocket::Core::Lua::LuaSystemInterface {
public:
RocketLuaSystemInterface();
~RocketLuaSystemInterface() override;
void PrepareFunction(lua_State* L, int funcIdx, Rocket::Core::Element* context) override;
void ReportError(lua_State* L, const Rocket::Core::String& location) override;
int ErrorHandler(lua_State* L) override;
};
} // namespace scpui