Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176

    problem returning tables

    I am having some problem with one of my functions:
    Code:
    function CheckLogin(User, Pass)
    	if File.DoesExist(_WindowsFolder.."\\omGOD DC\\Logins\\"..User..".oel") then
    		sFold = _TempFolder.."\\omGOD DC\\";
    		Crypto.BlowfishDecrypt(_WindowsFolder.."\\omGOD DC\\Logins\\"..User..".oel", _TempFolder.."\\"..User..".zip", "pass");
    		Zip.Extract(_TempFolder.."\\"..User..".zip", {"User.ini"}, _TempFolder.."\\omGOD DC\\"..User, true, true, "pass", ZIP_OVERWRITE_ALWAYS, nil);
    		ePass = INIFile.GetValue(_TempFolder.."\\omGOD DC\\"..User.."\\User.ini", "UserData", "pDesc");
    		dPass = Decrypt(ePass);
    		if Pass == dPass then
    			Zip.Extract(_TempFolder.."\\"..User..".zip", {"*.*"}, _TempFolder.."\\omGOD DC\\"..User, true, true, "pass", ZIP_OVERWRITE_ALWAYS, nil);
    			ldTable = {}
    			ldTable.Correct = true;
    			ldTable.uPic = _TempFolder.."\\omGOD DC\\"..User.."uPic.img";
    			ldTable.pDesc = INIFile.GetValue(_TempFolder.."\\omGOD DC\\"..User.."\\User.ini", "UserData", "pDesc");
    			ldTable.uName = User;
    			return ldTable
    		end
    	else
    		ldTable = {}
    		ldTable.Correct = false;
    		return ldTable
    	end
    end
    For some reason it wont return ldTable,and instead i get a nil value (currently only ldTable.Correct though i cant check the others if that wont work until that one does). I dont see why because i have returned tables before in the same way.

    Any help would be appreciated.

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    Is this a function defined somewhere else? "dPass = Decrypt(ePass);"

  3. #3
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    yeh, its a custom encryption and decryption function (not releasing as i use it alot). I know that function works because i spent a couple of months writing and debugging every last part of it.

  4. #4
    Join Date
    Jul 2003
    Posts
    712
    In the logic above, if the file exists, but the decrypted pass doesn't equal the pass, nothing will be returned.

    What if you initialize ldTable at the start of the function, and set ldTable.Correct = false as a default value. Then set it to true where required. At the end of your function, after all comparisons, return the value of ldTable ... ldTable.Correct will be false, unless one of your conditions modifies it.

    So in essence:

    Code:
    function CheckLogin(User, Pass)
        ldTable = {};
        ldTable.Correct = false;
        if (something == something2) then
            ldTable.Correct = true;
        end
        return ldTable;
    end
    Can you construct a similar case to the above to confirm the table is in fact being returned? Once you get that working ... add in the more complex stuff.

    Desmond.

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    this should fix it:

    Code:
    function CheckLogin(User, Pass)
    	if File.DoesExist(_WindowsFolder.."\\omGOD DC\\Logins\\"..User..".oel") then
    		sFold = _TempFolder.."\\omGOD DC\\";
    		Crypto.BlowfishDecrypt(_WindowsFolder.."\\omGOD DC\\Logins\\"..User..".oel", _TempFolder.."\\"..User..".zip", "pass");
    		Zip.Extract(_TempFolder.."\\"..User..".zip", {"User.ini"}, _TempFolder.."\\omGOD DC\\"..User, true, true, "pass", ZIP_OVERWRITE_ALWAYS, nil);
    		ePass = INIFile.GetValue(_TempFolder.."\\omGOD DC\\"..User.."\\User.ini", "UserData", "pDesc");
    		dPass = Decrypt(ePass);
    		if Pass == dPass then
    			Zip.Extract(_TempFolder.."\\"..User..".zip", {"*.*"}, _TempFolder.."\\omGOD DC\\"..User, true, true, "pass", ZIP_OVERWRITE_ALWAYS, nil);
    			ldTable = {}
    			ldTable.Correct = true;
    			ldTable.uPic = _TempFolder.."\\omGOD DC\\"..User.."uPic.img";
    			ldTable.pDesc = INIFile.GetValue(_TempFolder.."\\omGOD DC\\"..User.."\\User.ini", "UserData", "pDesc");
    			ldTable.uName = User;
    			return ldTable
    		else
    			ldTable = {}
    			ldTable.Correct = false;
    			return ldTable
    		end
    	else
    		ldTable = {}
    		ldTable.Correct = false;
    		return ldTable
    	end
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  6. #6
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    thanks for the suggestions. I went with RizlaUK's suggestion and it works brilliantly now. Can't believe i forgot that bit, *hits self*.

    thanks again, much apreciation.
    J.D.

Similar Threads

  1. creating dynamic tables inside tables...
    By Jonas DK in forum AutoPlay Media Studio 6.0
    Replies: 24
    Last Post: 04-25-2007, 09:56 AM
  2. Problem installing fonts
    By ByronFS in forum Setup Factory 7.0
    Replies: 5
    Last Post: 05-08-2006, 12:23 PM
  3. Always confusing with tables
    By arnaud in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 01-25-2004, 06:33 PM
  4. PROBLEM: Setup Starts and then Crashes
    By Support in forum Setup Factory 5.0
    Replies: 0
    Last Post: 10-15-2002, 03:02 PM
  5. INFO: Tips for Debugging Action Lists in AutoPlay Media Studio 4.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-03-2002, 08:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts