Move some stuff out of LuaStack

This commit is contained in:
2026-02-24 23:44:10 -05:00
parent 2c2d4e44bb
commit 829537a8d6
11 changed files with 407 additions and 410 deletions

View File

@@ -850,6 +850,18 @@ static std::string_view read_number_x(const char *p, bool plus, bool minus, bool
return sv::read_number(source, plus, minus, dec, exp);
}
eng::string util::decode_token(uint64_t value) {
static const char encoding[] =
"\0_0123456789abcdefghijklmnopqrstuvwxyz";
uint64_t n = value;
char buffer[13] = {};
for (int i = 11; i >= 0; i--) {
buffer[i] = encoding[n % 38];
n /= 38;
}
return eng::string(buffer);
}
LuaDefine(unittests_util, "", "some unit tests") {
// Test valid_hostname
LuaAssert(L, sv::valid_hostname("foo123"));