The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit f98600be authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Extended LuaTableTreeModel to show SWIG type of LUA_TUSERDATA values if present.

refs #643
parent 27ba3923
...@@ -135,14 +135,22 @@ namespace campvis { ...@@ -135,14 +135,22 @@ namespace campvis {
QString LuaTreeItemLeaf::getValue() const { QString LuaTreeItemLeaf::getValue() const {
QString toReturn; QString toReturn;
lua_State* L = _parentTable->getLuaVmState().rawState();
LuaStateMutexType::scoped_lock lock(_parentTable->getLuaVmState().getMutex());
if (_type == LUA_TSTRING || _type == LUA_TNUMBER) { if (_type == LUA_TSTRING || _type == LUA_TNUMBER) {
lua_State* L = _parentTable->getLuaVmState().rawState();
LuaStateMutexType::scoped_lock lock(_parentTable->getLuaVmState().getMutex());
_parentTable->pushField(_name); _parentTable->pushField(_name);
toReturn = QString(lua_tostring(L, -1)); toReturn = QString(lua_tostring(L, -1));
_parentTable->popRecursive(); _parentTable->popRecursive();
} }
else if (_type == LUA_TUSERDATA) {
auto mt = _parentTable->getMetatable(_name);
if (mt) {
mt->pushField(".type");
toReturn = "[" + QString(lua_tostring(L, -1)) + "]";
mt->popRecursive();
}
}
return toReturn; return toReturn;
} }
......
...@@ -52,10 +52,11 @@ namespace campvis { ...@@ -52,10 +52,11 @@ namespace campvis {
virtual bool isValid() override; virtual bool isValid() override;
virtual void callInstanceMethod(const std::string& name) override; virtual void callInstanceMethod(const std::string& name) override;
protected:
virtual void pushField(const std::string& name) override; virtual void pushField(const std::string& name) override;
virtual void popRecursive() override; virtual void popRecursive() override;
protected:
virtual void populateValueMap() override; virtual void populateValueMap() override;
virtual LuaTable* getParentTable() override; virtual LuaTable* getParentTable() override;
}; };
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <string> #include <string>
#include "scripting/swigluarun.h" #include "scripting/swigluarun.h"
#include "scripting/glue/globalluatable.h" #include "scripting/glue/globalluatable.h"
#include "scripting/glue/metatableluatable.h"
#include "tbb/recursive_mutex.h" #include "tbb/recursive_mutex.h"
extern "C" { extern "C" {
......
...@@ -29,9 +29,10 @@ namespace campvis { ...@@ -29,9 +29,10 @@ namespace campvis {
virtual bool isValid() override; virtual bool isValid() override;
virtual void callInstanceMethod(const std::string& name) override; virtual void callInstanceMethod(const std::string& name) override;
protected:
virtual void pushField(const std::string& name) override; virtual void pushField(const std::string& name) override;
virtual void popRecursive() override; virtual void popRecursive() override;
protected:
virtual void populateValueMap() override; virtual void populateValueMap() override;
virtual LuaTable* getParentTable() override; virtual LuaTable* getParentTable() override;
......
...@@ -53,9 +53,10 @@ namespace campvis { ...@@ -53,9 +53,10 @@ namespace campvis {
virtual bool isValid() override; virtual bool isValid() override;
virtual void callInstanceMethod(const std::string& name) override; virtual void callInstanceMethod(const std::string& name) override;
protected:
virtual void pushField(const std::string& name) override; virtual void pushField(const std::string& name) override;
virtual void popRecursive() override; virtual void popRecursive() override;
protected:
virtual void populateValueMap() override; virtual void populateValueMap() override;
virtual LuaTable* getParentTable() override; virtual LuaTable* getParentTable() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment