mustafa06
06-08-2009, 11:38 AM
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... :o
ShadowUK
06-08-2009, 02:16 PM
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... :o
Not tested, Wrote it in here.
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);
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.