add utf8.escape, string.escape & reformat extensions.md

This commit is contained in:
MihailRis
2024-11-18 09:21:16 +03:00
parent 618a9f0411
commit dcd8871ee1
7 changed files with 85 additions and 44 deletions
+6
View File
@@ -94,6 +94,11 @@ static int l_encode(lua::State* L) {
return lua::pushlstring(L, bytes, count);
}
static int l_escape(lua::State* L) {
auto string = lua::require_lstring(L, 1);
return lua::pushstring(L, util::escape(string));
}
const luaL_Reg utf8lib[] = {
{"tobytes", lua::wrap<l_tobytes>},
{"tostring", lua::wrap<l_tostring>},
@@ -103,5 +108,6 @@ const luaL_Reg utf8lib[] = {
{"upper", lua::wrap<l_upper>},
{"lower", lua::wrap<l_lower>},
{"encode", lua::wrap<l_encode>},
{"escape", lua::wrap<l_escape>},
{NULL, NULL}
};