View Full Version : How do I use gir.WriteConfigTable?
May 31st, 2007, 07:19 PM
Can someone please tell me how to use gir.WriteConfigTable?
There is no mention of it in the help file, and I cannot find any explanation on the forum either.
I've tried this line:
gir.WriteConfigTable (PersistentVariables,'c:\\cerberus\\Variables.gir' )
and I get an error telling me that I'm trying to use a string rather than a table, though if I use table.print (PersistentVariables), I see the whole table structure.
May 31st, 2007, 07:51 PM
gir.WriteConfigTable ('c:\\cerberus\\Variables.gir', PersistentVariables )
May 31st, 2007, 10:26 PM
No luck. Also tried
gir.WriteConfigTable ('c:\\cerberus\\Variables.gir', PersistentVariables, 1)
June 1st, 2007, 03:41 AM
Probably not related, but the first parameter isn't a path. Config files are always stored in the config folder.
If the 'error' you're seeing is that the file isn't being created then that's probably the reason.
If you're getting an actual error message then let us know.
June 1st, 2007, 04:52 AM
Here are the errors I'm getting:
...am Files (x86)\Promixis\Girder5\luascript\Pickle.lua:16: can only pickle tables, not numbers
[C]: in function `error'
...am Files (x86)\Promixis\Girder5\luascript\Pickle.lua:16: in function <...am Files (x86)\Promixis\Girder5\luascript\Pickle.lua:14>
(tail call): ?
...Files (x86)\Promixis\Girder5\luascript\girconfig.lua:187 : in function `WriteConfigTable'
[string "CERBERUS3-1.gml:\Startup and Exit\Initializ..."]:2: in main chunk
When I try this line:
gir.WriteConfigTable (PersistentVariables, 1)
The Config files stored in the config folder are in application data under Promixis\5 ? I see a config.dat file there, but no PersistentVariables file. I don't know what the parameters are because there is no documentation anywhere.
June 1st, 2007, 07:38 AM
That should be something like
gir.WriteConfigTable('MyVars', PersistentVariables, 1) -- the 1 means make 1 backup
June 1st, 2007, 02:23 PM
OK, That works. Thank you.
I'll have to remember to back that directory up when I back up my GMLs etc.
June 7th, 2007, 01:58 AM
Sorry, I thought it would be easy to figure out how to read it back into the respective variables in the table, but I'm having trouble.
Rob, can you please give me the syntax for reading the config table? Thanks.
June 7th, 2007, 02:35 AM
myTable = gir.ReadConfigTable('myconfig')
Where myconfig is the name used to save it.
BTW the code for all this is in luascript\girconfig.lua
June 7th, 2007, 04:06 AM
Thanks for the info.
June 7th, 2007, 08:33 AM
Just curious what you are trying to do?
June 7th, 2007, 10:35 AM
Well, I've gone back and set up all of my variables that I want to be persistent, even after a reboot or Girder restart, into one table.
I could set a variable to keep track of whether the TV is on or not for example, so that I could do certain things like turn it on if it's off when I go into TV mode on the remote without having to press power, or having the TV on a schedule so that my place looks even more lived in than just having lights on a schedule. The problem that I was having though was that everytime I rebooted or restarted Girder it would get all confused and it was totally uncoordinated. I started writing to the registry, but you had mentioned it was a bad idea. I didn't feel like fixing it at the time, but when I switched to G5 I had to fix it because my GML keept looking in the wriong place in the registry. So now I'm finally fixing it.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.