refactor(nochatreports): simplify crypt macro

This commit is contained in:
2025-03-09 14:02:47 -04:00
parent c1268a8970
commit 884081d414
2 changed files with 20 additions and 46 deletions
+2 -12
View File
@@ -42,24 +42,14 @@ pub fn register_globals(lua: &Lua, globals: &Table) -> Result<()> {
globals.set(
"ncr_encrypt",
lua.create_function(|_, (options, plaintext): (Table, String)| {
Ok(crypt!(
encrypt,
options.get("encoding").unwrap_or_default(),
options,
plaintext
))
Ok(crypt!(encrypt, options, &plaintext))
})?,
)?;
globals.set(
"ncr_decrypt",
lua.create_function(|_, (options, ciphertext): (Table, String)| {
Ok(crypt!(
decrypt,
options.get("encoding").unwrap_or_default(),
options,
ciphertext
))
Ok(crypt!(decrypt, options, &ciphertext))
})?,
)?;