store_key(3)
β¨ 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 π
- The
/+=characters are allowed to support base64 encoded values β that's literally why they're invited to the party π§ - 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. - 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 length0= 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
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms