Graphic folder

Post Reply
User avatar
Omit
Posts: 190
Joined: Sun Aug 01, 2010 10:54 pm
Location: Middle Earth
Contact:

Graphic folder

Post by Omit » Mon Aug 09, 2010 10:26 am

here is just a little code that can be used in a script
It creates a database to store the path of the graphic folder, on first run it will ask the user to find it and store the value, it loads the value when the script starts and checks to make sure it's valid.(If folder is no longer valid it will ask again.)
Code: [show] | [select all] lua
local savesetting = db:create("graphicfolder", {setting = {gfx = "",_unique = {"gfx"},_violations = "REPLACE"}   })
results = db:fetch(savesetting.setting)
if results[1]==nil then
gfx_path = ""
else
gfx_path = results[1]["gfx"]
end
if io.exists(gfx_path)==false then
gfx_path = invokeFileDialog(false, "Find me the gfx folder, please")
db:add(savesetting.setting, {gfx=gfx_path})
end
just thought I would share.

User avatar
Vadi
Posts: 4720
Joined: Sat Mar 14, 2009 3:13 pm

Re: Graphic folder

Post by Vadi » Mon Aug 09, 2010 11:16 am

It does look smaller than my flat-file solution!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest