write_rawresource(3)

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

πŸ’– write_rawresource(3) β€” the Arcan Lua API one πŸ’–

okay bestie, welcome to the Arcan Lua API page for write_rawresource, and yes it is exactly as niche and specific as it sounds. this one writes a line out to the globally shared raw resource handle. that's it. that's the whole gig. slay.


✨ NAME ✨

write_rawresource β€” writes a line from the globally shared raw resource handle. one line. from the shared handle. globally. you got this πŸ’…


🌸 SYNOPSIS 🌸

line
write_rawresource()

lowkey the synopsis is giving cryptic, but it's right there in the original so we keep it exactly as-is, no cap 🫢


πŸ¦‹ NOTES πŸ¦‹

  1. every single "line" is capped at a maximum of 256 characters β€” that's the vibe check, and it's a hard one 😭
  2. leading and trailing whitespace gets removed. gone. yeeted. do not rely on a sneaky space at the start or end surviving, because it will not πŸ™ˆ
  3. not me having to say this but β€” this is not intended as a primary I/O mechanism. it's a fallback, a little side quest for logging and code/configuration generation, and it's purposely limited in how it works. also, heads up: it is synchronously blocking. blocking. as in it blocks. fr fr πŸ’€
bestie please internalise note 3. this is a logging/gen fallback with a 256-char leash that blocks while it works β€” not your main character I/O situation πŸ‘‘

πŸŽ€ EXAMPLE πŸŽ€

okay so here's the little test loop they give you β€” open, write, close, reopen, read, compare, warn. iconic behaviour honestly ✨

function write_rawresource0()
      zap_resource("test.txt");
      open_rawresource("test.txt");
      write_rawresource("linea");
      close_rawresource();
      open_rawresource("test.txt");
      local line = read_rawresource();
      close_rawresource();
      if (line == "linea") then
            warning("resource test OK");
      else
            warning("resource test failed");
      end
end

like. zap_resource the file, open_rawresource("test.txt"), write_rawresource("linea"), close_rawresource(), reopen it, read_rawresource() it back, close again, and then a whole dramatic if (line == "linea") moment where you either warning("resource test OK") or warning("resource test failed"). round-trip test, we love to see it 🧚


🌈 SEE ALSO 🌈

these are the rest of the resource squad, go say hi πŸ‘‹


and that's the page!! source <purple>resource</purple>, dated October 2026, and the page itself is write_rawresource(3) β€” mwah, go write one line at a time bestie πŸ’œπŸŽ€β­

πŸ“¦ where this page comes from