Girder persistent varibles using ptables

From ETCwiki
Revision as of 15:26, 25 July 2015 by Ddxfish (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This will describe how to set variables in Girder (LUA script) using ptables. The new variable will be stored in the system registry and can be accessed even after restarts of LUA, girder, and the system. These variables do not show in Girder's variable inspector, but can be viewed using methods below.

Setting permanent variables in Girder

  1. create new scripting action and add this to the code section:


require('ptable')

myptable = ptable:New("myvariables")

myptable.setting1 = "Dark"


Make sure you execute this action (use the test button in girder)

Girder variables on website

  1. edit your girder website file events.html (in your girder directory, in the httpd folder)
  2. scroll down to just below the /h2 tag and enter this code in its own line
    1. <% webserver:print(myptable.setting1) %>
  3. navigate to your events.html page


Print girder variable in lua console

Enter the Interactive LUA console and type the following:

print (myptable.setting1)

The response should be your variable.