PDA

View Full Version : Lost in LUA...



shadzar
November 18th, 2018, 16:24
Ok. i need some data from within FG that can be used in LUA scripting...

Path_to_open_campaign

since FG knows the proper folder to save the campaign to when it /saves there must be an internal global variable to the LUA scripting engine that contains this environment variable. standard LUA script_path() function returns {a nil value}.

So would this be something in a ruleset script i can find or is it something only internal to the program itself and not accessible to LUA scripts?

So is there a quick and easy way within FG scripting that i can access this environment variable since it isnt responding to standard LUA io.open globals?

i checked the refdocs and could find nothing on this.

if it is in a ruleset or extension already that uses this, then please link me to such so i can find this environment global.

madman
November 18th, 2018, 17:02
according to the wiki

The following standard libraries are NOT available in the FG sandbox


io
os (except os.clock, os.date, os.time, and os.difftime)
debug
package

but i am a noob, not sure if that helps...

shadzar
November 18th, 2018, 18:56
right, saw that.

but FG has to know where to save files otherwise it would not be able to save the correct db.xml in the correct campaign folder. ;)

is it LUA or FG core that loads a backup session if the db.xml is corrupt? if it is a LUA that does it, then which LUA file does it so i can find the environment variable?

celestian
November 18th, 2018, 23:57
Not sure if this helps any at all but:

HKEY_CURRENT_USER\Software\Fantasy Grounds\2.0\DataDir

Not sure if there is a way to grab that within a extension and/or FG API via lua tho.

shadzar
November 19th, 2018, 00:13
i wouldn't touch the registry with LUA if Doug paid me $100 million for this extension.