store_key(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

✨ store_key(3) β€” Arcan Lua API ✨

Okay bestie, welcome to store_key(3) from the Arcan Lua API β€” literally the page where you learn how to stash key-value pairs in the database πŸ’ΎπŸ’…


🌸 NAME 🌸

store_key β€” store one or several key-value pairs in the database. That's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

true or false
store_key( argtbl or [key, val], opttgt, optcfg )

Yes queen, it hands you back true or false β€” a little truthy snack for your trouble ⭐


πŸ’– DESCRIPTION πŸ’–

So there are, like, multiple key-value stores kicking around, each one keeping track of its own specific key-value pairs πŸ‘‘

The default one is bound to the currently running appl β€” that's your home base, your main character store 🫢

But there's also one connected to each execution target, and you get at it by setting opttgt to any value returned from calling list_targets ✨

And if you set both opttgt and optcfg to a valid target-configuration pair, you get an execution target configuration specific key-value store πŸ”₯ iykyk

One thing, no cap: only characters in the set [a-Z][0-9]_/+= are valid key values πŸ™ˆ So keep your keys cute and legal.


πŸŽ€ NOTES πŸŽ€

  1. The /+= characters are allowed to support base64 encoded values β€” that's literally why they're invited to the party 🧚
  2. If the string length of a value field is set to 0, the key will be deleted πŸ’€ So setting it to empty is not "clearing" it, it's yeeting it, bestie. Be sure that's what you want.
  3. To set multiple pairs at once, pack them in a key-indexed table πŸ“¦ Slay.

🌈 EXAMPLE 🌈

function store_key0()
      tbl = {key_a = "ok", key_b = "ok"};
      store_key(tbl);
      store_key("key_c", "ok");
      print(get_key("key_a"));
      print(get_key("key_b"));
      print(get_key("key_c"));
      local tgtlist = list_targets();
      if (#tgtlist > 0) then
            store_key(tbl, tgtlist[1]);
            store_key(tbl, tgtlist[1], target_configurations(tgtlist[1])[1]);
      end
end

Look at her go β€” stuffing a whole table in, then a single pair, then reading it all back, then doing the target + target-configuration dance πŸ•Ίβœ¨ Obsessed.


πŸ‘‘ SEE ALSO πŸ‘‘

Go read those next, bestie, they're the supporting cast πŸ’œ


Heads up: keys only get to use [a-Z][0-9]_/+=. Anything else? Not invited. πŸ™…β€β™€οΈ And remember, value length 0 = deletion, not "empty string". πŸ’€

And that's the whole page, fr fr 🌸 This gem comes from the database corner of the Arcan Lua API, dated October 2026 β€” mwah, iconic, periodt πŸ’…πŸ’–πŸ¦‹

πŸ“¦ where this page comes from