starlit  Diff

Differences From Artifact [ded7121fc6]:

  • File mods/vtlib/str.lua — part of check-in [953151446f] at 2024-05-05 19:31:39 on branch trunk — better alarm LEDs, continue work on matter compiler UI, hack around gravitational horrorscape (i.e. stop shitting all over the server's `minetest.conf`), better stat interface, tweak some compute stats, be more generous with starting battery loadout, mercilessly squash numberless bugs beneath my jackbooted heel (user: lexi, size: 5957) [annotate] [blame] [check-ins using]

To Artifact [b2f5363bf4]:


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
		['\xf2'] = '\2';
		['\xf3'] = '\3';
		['\xf4'] = '\0';
	};
}

local utf8
if _G.minetest then
	if minetest.global_exists 'utf8' then
		utf8 = _G.utf8
	end
else
	utf8 = _G.utf8
end
if not utf8 then -- sigh
	utf8 = {}
................................................................................
		end
		return str
	end;

	meta_armor = function(str,mark_struct)
		-- binary values stored in metadata need to be sanitized so
		-- they don't contain values that will disrupt parsing of the
		-- KV store, as minetest (stupidly) uses in-band signalling
		local sanitized = string.gsub(str, '.', function(char)
			if sanitable.from[char] then
				return '\xfe' .. sanitable.from[char]
			else return char end
		end)
		if sanitized ~= str and mark_struct then
			-- use different type code to mark struct headers for







|
|







 







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
		['\xf2'] = '\2';
		['\xf3'] = '\3';
		['\xf4'] = '\0';
	};
}

local utf8
if _G.core then
	if core.global_exists 'utf8' then
		utf8 = _G.utf8
	end
else
	utf8 = _G.utf8
end
if not utf8 then -- sigh
	utf8 = {}
................................................................................
		end
		return str
	end;

	meta_armor = function(str,mark_struct)
		-- binary values stored in metadata need to be sanitized so
		-- they don't contain values that will disrupt parsing of the
		-- KV store, as luanti (stupidly) uses in-band signalling
		local sanitized = string.gsub(str, '.', function(char)
			if sanitable.from[char] then
				return '\xfe' .. sanitable.from[char]
			else return char end
		end)
		if sanitized ~= str and mark_struct then
			-- use different type code to mark struct headers for