Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Use strings
- ie
- '0, -0.699999988, -0.199999973, -1, 0, 0, 0, 0.965925753, 0.258819073, 0, 0.258819073, -0.965925753'
- No "CFrame.new"
- returns a smaller string or a table of smaller strings depending on the amount of args.
- --]]
- local function String_Shortener(...)
- local a_Table,end_table,Steps={...},{},{
- --// Remove spaces
- Step_1=function(s)local whole_string='';for a=1,s:len()do
- local letter = s:sub(a,a);if letter~=' 'then
- whole_string=whole_string..letter;end;end;return whole_string;
- end;
- --// Remove First Leading Zero if its in the ones digit if the number is not 0 and its
- --// Between 1 and -1.
- Step_2=function(s)local Last_Argument,whole_string,At_End=1,'',false;
- repeat local End_String='';
- local Comma_Arg,SC_Arg=string.find(s,',',Last_Argument)or s:len(),
- string.find(s,';',Last_Argument)or s:len();
- local End_Letter=(Comma_Arg>SC_Arg and SC_Arg)or(Comma_Arg<SC_Arg and
- Comma_Arg)or s:len()+1;
- local number_string=s:sub(Last_Argument,End_Letter-1);
- local number=tonumber(number_string);
- if number then
- local Is_Negative,new_number=(number<0 and'-')or'','';
- if number~=0 and number<1 and number>-1 then
- --Range: -1<number<1, number~=0
- local Positive_Number=tostring(math.abs(number));
- new_number=(Positive_Number:sub(1,1)=='0'and
- Positive_Number:sub(2))or tostring(math.abs(number));
- else new_number=tostring(math.abs(number));end;
- End_String=whole_string..Is_Negative..new_number..',';
- else End_String=whole_string..number_string..',';end;
- local Check=End_String:sub(End_String:len()-1);
- if Check==',,'then break;end;
- whole_string=End_String;Last_Argument=End_Letter+1;wait();
- until At_End;
- if whole_string:sub(whole_string:len())==','then
- whole_string=whole_string:sub(1,whole_string:len()-1);end;
- return whole_string;
- end;
- };
- for _,v in pairs(a_Table)do v=tostring(v);
- if v:sub(1,4)=='Enum'then local dot=(function()local last_pos,temp_var=1,nil;repeat
- temp_var=string.find(v,'%.',last_pos);if temp_var then
- last_pos=temp_var+1;end;wait();
- until not temp_var or workspace:FindFirstChild'Stop';return last_pos;end)();
- table.insert(end_table,"'"..v:sub(dot).."'")
- else local End_v=v;for _,c in pairs(Steps)do
- End_v=c(End_v); --// Apply all functions.
- end;table.insert(end_table,End_v);
- end;
- end;
- return(#end_table==1 and unpack(end_table))or end_table;
- end;
- return String_Shortener
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement