summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-20 23:24:58 +0800
committerruki <[email protected]>2026-01-20 23:24:58 +0800
commitf8ab0100d040c5b96f52062caa9b912fe08cc9b6 (patch)
tree1f6f3d054d1958849713951b5323cb16c4ca7b98
parente0f8104c1a0e0e62a4c5f02fa7457f308b27e5dd (diff)
modify comments
-rw-r--r--core/src/xmake/engine.c3
-rw-r--r--xmake/core/base/utf8.lua10
2 files changed, 8 insertions, 5 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 90e583c93..ff7c79061 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -1569,9 +1569,6 @@ xm_engine_ref_t xm_engine_init(tb_char_t const *name, xm_engine_lni_initalizer_c
// bind utf8 functions
xm_lua_register(engine->lua, "utf8", g_utf8_functions);
- lua_pushstring(engine->lua, "[\0-\x7F\xC2-\xFD][\x80-\xBF]*");
- lua_setfield(engine->lua, -2, "charpattern");
- lua_pop(engine->lua, 1);
// bind string functions
xm_lua_register(engine->lua, "string", g_string_functions);
diff --git a/xmake/core/base/utf8.lua b/xmake/core/base/utf8.lua
index d855b5fde..1a1edc0ea 100644
--- a/xmake/core/base/utf8.lua
+++ b/xmake/core/base/utf8.lua
@@ -16,6 +16,10 @@
--
-- @author ruki
-- @file utf8.lua
+
+-- define module: utf8
+local utf8 = utf8 or {}
+
-- @desc The utf8 module
-- It provides basic support for UTF-8 encoding.
-- It is compatible with Lua 5.3+ utf8 library.
@@ -27,8 +31,10 @@
-- @interface utf8.codes(s [, lax])
--
--- define module: utf8
-local utf8 = utf8 or {}
+-- the char pattern
+if not utf8.charpattern then
+ utf8.charpattern = "[\0-\x7F\xC2-\xFD][\x80-\xBF]*"
+end
-- return module: utf8
return utf8