Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 2 of 2

Thread: Need Help -.-

  1. #1
    Join Date
    Jul 2007
    Posts
    287

    Need Help -.-

    Code:
    tbData = TextFile.ReadToTable("C:\\1.txt");---İn Text File > Line 1 : "255 255 255"
    strData = String.Replace(tbData[1], " ", ",", false);
    RGB = Math.RGBToNumber(strData); -- [ X,X,X But how i can edit tbData for convert the string X,X,X and working normaly ]


    Help please...

  2. #2
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by mustafa06 View Post
    Code:
    tbData = TextFile.ReadToTable("C:\\1.txt");---İn Text File > Line 1 : "255 255 255"
    strData = String.Replace(tbData[1], " ", ",", false);
    RGB = Math.RGBToNumber(strData); -- [ X,X,X But how i can edit tbData for convert the string X,X,X and working normaly ]


    Help please...
    Not tested, Wrote it in here.

    Code:
    local InputString = TextFile.ReadToString("C:\\1.txt");
    local Seperator = " ";
    
    local DelimitedTable = {};
    local Position = 0;
    
    while (true) do
    	CurrentPosition = string.find(InputString, Seperator, Position, true);
    	
    	if (CurrentPosition ~= nil) then
    		table.insert(DelimitedTable, string.sub(InputString, Position, CurrentPosition - 1));
    		Position = CurrentPosition + 1;
    	else
    		table.insert(DelimitedTable, string.sub(InputString, Position));
    		break;
    	end
    end
    
    R = DelimitedTable[1];
    G = DelimitedTable[2];
    B = DelimitedTable[3];
    
    Math.RGBToNumber(R, G, B);

  3. #3
    Join Date
    Jul 2007
    Posts
    287
    thx working

Posting Permissions

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