Difference between revisions of "Girder persistent varibles using ptables"
From ETCwiki
Jump to navigationJump to searchLine 27: | Line 27: | ||
The response should be your variable. | The response should be your variable. | ||
+ | |||
+ | [[Category:Girder]] |
Latest revision as of 15:26, 25 July 2015
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
- 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
- edit your girder website file events.html (in your girder directory, in the httpd folder)
- scroll down to just below the /h2 tag and enter this code in its own line
- <% webserver:print(myptable.setting1) %>
- 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.