--BulletDust by Polarity --Build 1 function setupGame() print("Now loading BulletDust...\n") end function setupData() BulletDust = {} BulletDust.Score = 0 BulletDust.Fullscreen = 0 BulletDust.Resolution = 1 BulletDust.Sound = 1 end function loadSettings() local settingsfile = open("settings/settings.dat") local settingsraw = settingsfile:read("*a") local settings = explode(",",settings) BulletDust.Fullscreen = settings[1] BulletDust.Resolution = settings[2] --0 = 640x480x16, 1 = 800x600x16, 2 = 1024x768x16, 3 = 640x480x32, 4 = 800x600x32, 5 = 1024x768x32 BulletDust.Sound = settings[3] end function processSettings() fullscreen(BulletDust.Fullscreen) res(BulletDust.Resolution) update() end function explode(d,p) local t,ll,l t={} ll=0 while true do l=string.find(p,d,ll+1,true) -- find the next d in the string if l~=nil then -- if "not not" found then.. table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array. ll=l+1 -- save just after where we found it for searching next time. else table.insert(t, string.sub(p,ll)) -- Save what's left in our array. break -- Break at end, as it should be, according to the lua manual. end end return t end setupGame() setupData() loadSettings() processSettings()