summaryrefslogtreecommitdiff
path: root/core/src/xmake/engine.c
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-26 22:38:45 +0800
committerruki <[email protected]>2022-04-26 22:38:45 +0800
commit7de522635bf6651b2e39140aa707bb90fae9e90f (patch)
tree2d944e15e5132ca3fdcf2afd71dd0820c1195c35 /core/src/xmake/engine.c
parentabc5735b2659094a2e6ce89437f0cacdf18bedbf (diff)
add base64
Diffstat (limited to 'core/src/xmake/engine.c')
-rw-r--r--core/src/xmake/engine.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 7040a75d9..6672a70bf 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -183,6 +183,10 @@ tb_int_t xm_path_is_absolute(lua_State* lua);
tb_int_t xm_hash_uuid4(lua_State* lua);
tb_int_t xm_hash_sha256(lua_State* lua);
+// the base64 functions
+tb_int_t xm_base64_encode(lua_State* lua);
+tb_int_t xm_base64_decode(lua_State* lua);
+
// the windows functions
#ifdef TB_CONFIG_OS_WINDOWS
tb_int_t xm_winos_cp_info(lua_State* lua);
@@ -387,6 +391,14 @@ static luaL_Reg const g_hash_functions[] =
, { tb_null, tb_null }
};
+// the base64 functions
+static luaL_Reg const g_base64_functions[] =
+{
+ { "encode", xm_base64_encode }
+, { "decode", xm_base64_decode }
+, { tb_null, tb_null }
+};
+
// the string functions
static luaL_Reg const g_string_functions[] =
{
@@ -932,6 +944,9 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c
// bind hash functions
xm_lua_register(engine->lua, "hash", g_hash_functions);
+ // bind base64 functions
+ xm_lua_register(engine->lua, "base64", g_base64_functions);
+
// bind string functions
xm_lua_register(engine->lua, "string", g_string_functions);