Code restructuring: eliminated the top-level lib/ directory

This commit is contained in:
Zef Hemel
2025-09-23 17:00:34 +02:00
parent 4fbdb4c9dd
commit f4336bf09f
175 changed files with 353 additions and 327 deletions
+19
View File
@@ -0,0 +1,19 @@
import { LuaBuiltinFunction, LuaTable } from "../runtime.ts";
import { base64Decode, base64Encode } from "../../../plug-api/lib/crypto.ts";
export const encodingApi = new LuaTable({
base64Encode: new LuaBuiltinFunction(
(_sf, s: string | Uint8Array): string => {
return base64Encode(s);
},
),
base64Decode: new LuaBuiltinFunction((_sf, s: string): Uint8Array => {
return base64Decode(s);
}),
utf8Encode: new LuaBuiltinFunction((_sf, s: string): Uint8Array => {
return new TextEncoder().encode(s);
}),
utf8Decode: new LuaBuiltinFunction((_sf, data: Uint8Array): string => {
return new TextDecoder().decode(data);
}),
});