2
0

LuaDocument.cpp 670 B

1234567891011121314151617181920212223242526272829
  1. #include "LuaDocument.h"
  2. #include <RmlUi/Core/Stream.h>
  3. #include <RmlUi/Lua/IncludeLua.h>
  4. #include <RmlUi/Lua/Interpreter.h>
  5. namespace Rml {
  6. namespace Lua {
  7. LuaDocument::LuaDocument(const String& tag) : ElementDocument(tag) {}
  8. void LuaDocument::LoadInlineScript(const String& context, const String& source_path, int source_line)
  9. {
  10. String buffer;
  11. buffer += "--";
  12. buffer += source_path;
  13. buffer += ":";
  14. buffer += Rml::ToString(source_line);
  15. buffer += "\n";
  16. buffer += context;
  17. Interpreter::DoString(buffer, buffer);
  18. }
  19. void LuaDocument::LoadExternalScript(const String& source_path)
  20. {
  21. Interpreter::LoadFile(source_path);
  22. }
  23. } // namespace Lua
  24. } // namespace Rml