1. 02 Jun, 2014 1 commit
    • Christian Schulte zu Berge's avatar
      Further work on Lua scripting console: · f1b3cd9a
      Christian Schulte zu Berge authored
      * Implemented one single gloabel Lua VM for the entire CampVisApplication instead of one VM for each pipeline.
      * The global Lua VM has a "pipelines" table/array, holding the pointers to each loaded pipeline
      * ScriptingWidget support cycling through last executed commands via the arrow keys
      * LuaVmState supports redirecting Lua's print() function to a custom one that uses tgt::Logmanager for printing (just as proof-of-concept). This shall later be extended to pass all Lua output to the scripting console.
      f1b3cd9a
  2. 10 May, 2014 2 commits
    • Artur Grunau's avatar
      Guard accesses to Lua state with a mutex · a337b188
      Artur Grunau authored
      Now that support for signals and slots has been added to Lua pipelines,
      each Lua state has to be protected with a mutex because it's not
      thread-safe and different threads (running LuaPipeline or a processor
      attached to it) may try to access it simultaneously.
      
      The mutex needs to be recursive due to the fact that Lua code can
      trigger the emission (or copying) of signals that have slots defined it
      Lua connected to them. This in turn causes the state to be accessed from
      a thread that, unbeknownst to it, already holds a lock on the mutex.
      
      A pointer to the mutex is stored in the state's registry; this way code
      that accesses Lua state directly (e.g. connections between sigslot's
      signals and slots defined in Lua) can retrieve and lock it when
      necessary.
      
      References #1
      a337b188
    • Artur Grunau's avatar
      Add several helper classes for accessing Lua state · 4e87e812
      Artur Grunau authored
      Interacting with Lua using its low-level C API quickly becomes cumbersome
      and error-prone. In such cases introducing an object-oriented glue layer
      makes accessing Lua state considerably easier.
      
      This commit adds several helper classes to campvis-scripting. The abstract
      LuaTable and its concrete sub-classes RegularLuaTable and GlobalLuaTable
      should make working with Lua tables more pleasant by reducing common
      operations to a single method call. LuaVmState's task is to simplify the
      management of Lua VM's state with various high level methods that do
      automatic error checking.
      
      The new classes are largely undocumented. This will be fixed in a future
      commit.
      
      References #1
      4e87e812