Coding

Plugins y todo lo relacionado para Autoplay Media Studio.
Hi to all
This plugin can convert string to number or number to string

For example:


result = Coding.Convert("AMS", true);
--return "65.77.83"



result = Coding.Convert("65.77.83", false);
--return "AMS"


Download link:
http://www.mediafire.com/download/6g5cj ... Coding.zip


Source code of Coding Action Plugin:


function Coding.Convert(A, B)
Code = "";
A = tostring(A);
if (B == true) then
Length = String.Length(A);
for X = 1, Length do 
SM = String.Mid(A, X, 1);
SA = String.Asc(SM);
if (Code == "") then
Code = SA;
else
Code = Code.."."..SA;
end
end
return Code;
else
Decode = "";
CodingC = Coding.Count(A, ".");
if (CodingC == 0) then
SC = String.Char(A);
return SC;
end
CodingC = Coding.Count(A, ".");
for X = 1, CodingC do
CodingP = Coding.Part(A, ".", X);
SC = String.Char(CodingP);
if (Decode == "") then
Decode = SC;
else
Decode = Decode..""..SC;
end
end
return Decode;
end
end

function Coding.Count(A, B)
LoopCount = 0;
SF = 0;
SplitterPlace = {};
if (B == "") then
return 0;
end
Length = String.Length(A);
for X = 1, Length do
SF = String.Find(A, B, SF+1, true);
if (SF == -1) then
break;
else
LoopCount = LoopCount+1;
Table.Insert(SplitterPlace, LoopCount, SF);
end
end
if (#SplitterPlace == 0) then
return 0;
end
return #SplitterPlace+1;
end

function Coding.Part(A, B, C)
C = tonumber(C);
LoopCount = 0;
SF = 0;
SplitterPlace = {0};
if (B == "") then
return nil;
end
Length = String.Length(A);
for X = 1, Length do
SF = String.Find(A, B, SF+1, true);
if (SF == -1) then
break;
else
LoopCount = LoopCount+1;
Table.Insert(SplitterPlace, LoopCount, SF);
end
end
if (#SplitterPlace == 1 or C <= 0 or C > #SplitterPlace) then
return nil;
end
if (C == 1) then
CharStart = 1;
NumChar = SplitterPlace[C]-1;
elseif (C == #SplitterPlace) then
CharStart = SplitterPlace[C-1]+1;
NumChar = Length-(SplitterPlace[C-1]);
else
CharStart = SplitterPlace[C-1]+1;
NumChar = SplitterPlace[C]-(SplitterPlace[C-1]+1);
end
SM = String.Mid(A, CharStart, NumChar);
return SM;
end
well this seems to be done against ams wrapper functions, as this is string-based work i suggest to use any faster approch using the bit library from luajit or even decompsing string in a for loop and turning a char to hex to a table, then you can concatenate it with any delimiter u want

regards
Hi pabloco.
I can not speak english goodly. how can i use luajit? what is luajit?
its a lua5.1.dll replacement that i've compiled and runs way faster than generic lua. It also includes new lua modules as bit or ffi that allow you to do bit manipulation and native control.

http://bitop.luajit.org/

You can download it on the official post in this forum
very thanks pabloco.
can i request to you to put the compiled LuaJIT in this topic?
I can not make luajit file because i don now know how can i work with cmd commands!
https://amsspecialist.com/viewtopic.php ... it=lua+jit

u may post something to download it...
thank you so much pabloco