<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Resource_data_storage</id>
	<title>Resource data storage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Resource_data_storage"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=Resource_data_storage&amp;action=history"/>
	<updated>2026-09-30T00:00:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=Resource_data_storage&amp;diff=992&amp;oldid=prev</id>
		<title>QCherry: Release 0.1.4 BUILD133 / Protocol 36 and document authenticated event origin</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=Resource_data_storage&amp;diff=992&amp;oldid=prev"/>
		<updated>2026-09-21T20:41:00Z</updated>

		<summary type="html">&lt;p&gt;Release 0.1.4 BUILD133 / Protocol 36 and document authenticated event origin&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:41, 21 September 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Resource data storage =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Resource data storage =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;&#039;Server-side; since 0.1.4 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(in development, not public 0.1.3)&lt;/del&gt;.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;&#039;Server-side; since 0.1.4.&#039;&#039;&#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Three resource-scoped persistence functions support map saves and Lua exports. They do not expose arbitrary filesystem paths or MySQL connections.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Three resource-scoped persistence functions support map saves and Lua exports. They do not expose arbitrary filesystem paths or MySQL connections.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=Resource_data_storage&amp;diff=931&amp;oldid=prev</id>
		<title>QCherry: Document Map Editor, saved maps, static scene deployment and Lua APIs since 0.1.4</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=Resource_data_storage&amp;diff=931&amp;oldid=prev"/>
		<updated>2026-09-20T18:19:34Z</updated>

		<summary type="html">&lt;p&gt;Document Map Editor, saved maps, static scene deployment and Lua APIs since 0.1.4&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Resource data storage =&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Server-side; since 0.1.4 (in development, not public 0.1.3).&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Three resource-scoped persistence functions support map saves and Lua exports. They do not expose arbitrary filesystem paths or MySQL connections.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Function !! Return !! File in the calling resource&lt;br /&gt;
|-&lt;br /&gt;
| [[readResourceData]]&amp;lt;code&amp;gt;(key)&amp;lt;/code&amp;gt; || JSON text string, or false for missing/invalid/unreadable data || &amp;lt;code&amp;gt;.storage/data-KEY.json&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[writeResourceData]]&amp;lt;code&amp;gt;(key, json)&amp;lt;/code&amp;gt; || boolean success; json must be a nonempty valid JSON string || &amp;lt;code&amp;gt;.storage/data-KEY.json&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[writeResourceText]]&amp;lt;code&amp;gt;(key, text)&amp;lt;/code&amp;gt; || boolean success; writes nonempty text without validating/executing Lua || &amp;lt;code&amp;gt;.storage/data-KEY.lua&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Keys contain 1-64 ASCII letters, digits, underscores or hyphens. Pass a key only, &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; a path, prefix &amp;lt;code&amp;gt;data-&amp;lt;/code&amp;gt; or extension. Each resource can access only its own storage root. &amp;lt;code&amp;gt;readResourceData&amp;lt;/code&amp;gt; reads JSON only; it does not read a writeResourceText Lua export. No matching generic Lua-text read function is exposed here.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local json = toJSON({format=&amp;quot;my-layout&amp;quot;, version=1, objects={}})&lt;br /&gt;
if json and writeResourceData(&amp;quot;layout&amp;quot;, json) then&lt;br /&gt;
    outputDebugString(&amp;quot;Layout saved&amp;quot;)&lt;br /&gt;
else&lt;br /&gt;
    outputDebugString(&amp;quot;Layout save failed&amp;quot;, 1)&lt;br /&gt;
end&lt;br /&gt;
local saved = readResourceData(&amp;quot;layout&amp;quot;)&lt;br /&gt;
local layout = saved and fromJSON(saved)&lt;br /&gt;
-- Validate your own schema before using layout; JSON validity is not a schema check.&lt;br /&gt;
&lt;br /&gt;
local exported = writeResourceText(&amp;quot;layout_export&amp;quot;, &amp;quot;MapScene = {}\n&amp;quot;)&lt;br /&gt;
-- This only writes text. It neither starts a resource nor executes that text.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Safety and limits ==&lt;br /&gt;
Maximum payload size: 1048576 bytes (1 MiB) per file. Before writing, the current storage directory is checked: a write is refused if existing regular files already total more than 64 MiB or their count exceeds 512; backups/temp files also count. These are pre-write admission checks, not a reservation of space for the incoming file and backup. Filesystem errors can also cause false. The map editor adds a stricter 1000000-byte transfer limit.&lt;br /&gt;
&lt;br /&gt;
Writes use a temporary file and replacement, retaining one &amp;lt;code&amp;gt;.bak&amp;lt;/code&amp;gt; copy when overwriting an existing destination. Keep independent backups; this is not a database transaction across multiple keys or an unlimited revision archive. Path traversal and symlink/junction escapes are rejected. Never accept untrusted client text as executable exported Lua; writeResourceText does not validate its content for you.&lt;br /&gt;
&lt;br /&gt;
The functions validate storage/JSON, not gameplay permissions: server scripts must authorize who may submit data, validate schema and bound request sizes/rates. The editor implements those checks and a named-map session lock. See [[Map editor]] for its filenames and [[Map scene deployment]] for the explicit publication step.&lt;br /&gt;
[[Category:Lua API]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>