Created
August 10, 2020 03:09
-
-
Save optimumtact/cce24ce2ada83e5b6e187ad6980a8b1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Concatenates a list of strings into a single string. A seperator may optionally be provided. | |
/proc/list2text(list/ls, sep) | |
if(ls.len <= 1) return ls.len ? ls[1] : "" | |
. = "" | |
var/l = ls.len | |
var/i = 0 | |
if(sep) | |
#define S1 ls[++i] | |
#define S4 S1, sep, S1, sep, S1, sep, S1 | |
#define S16 S4, sep, S4, sep, S4, sep, S4 | |
#define S64 S16, sep, S16, sep, S16, sep, S16 | |
while(l-i >= 128) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, sep, S64) | |
if(l-i >= 64) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) | |
if(l-i >= 32) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, sep, S16) | |
if(l-i >= 16) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16) | |
if(l-i >= 8) | |
. = text("[][][][][][][][][][][][][][][][]", ., S4, sep, S4) | |
if(l-i >= 4) | |
. = text("[][][][][][][][]", ., S4) | |
if(l-i >= 2) | |
. = text("[][][][]", ., S1, sep, S1) | |
if(l > i) | |
. = text("[][][]", ., sep, S1) | |
#undef S64 | |
#undef S16 | |
#undef S4 | |
#undef S1 | |
else | |
#define S1 ls[++i] | |
#define S4 S1, S1, S1, S1 | |
#define S16 S4, S4, S4, S4 | |
#define S64 S16, S16, S16, S16 | |
while(l-i >= 128) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64) | |
if(l-i >= 64) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ | |
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) | |
if(l-i >= 32) | |
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16) | |
if(l-i >= 16) | |
. = text("[][][][][][][][][][][][][][][][][]", ., S16) | |
if(l-i >= 8) | |
. = text("[][][][][][][][][]", ., S4, S4) | |
if(l-i >= 4) | |
. = text("[][][][][]", ., S4) | |
if(l-i >= 2) | |
. = text("[][][]", ., S1, S1) | |
if(l > i) | |
. += S1 | |
#undef S64 | |
#undef S16 | |
#undef S4 | |
#undef S1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment