sorcery  Diff

Differences From Artifact [64ce434f04]:

  • File lib/str.lua — part of check-in [3f6a913e4e] at 2020-09-29 12:40:28 on branch trunk — * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior * initial documentation commit * initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes (user: lexi, size: 2303) [annotate] [blame] [check-ins using]

To Artifact [345c990ba7]:

  • File lib/str.lua — part of check-in [ea6e475e44] at 2020-10-19 09:52:11 on branch trunk — continue dev on celestial mechanics, add melding+division spells (resonance), refine itemclasses, add keypunch and punchcards, add paper pulp, add a shitload of visuals, add convenience scripts for working with the wiki, make the flamebolt spell actually useful instead of just a pretty lightshow, add essences, inferno crystal, and other goodies; iterate on wands, lots of shit i can't remember, various bugfixes (user: lexi, size: 2983) [annotate] [blame] [check-ins using]

10
11
12
13
14
15
16





17





18
19

20
21










22






23
24

25
26
27
28
29
30
31
	['\xf3'] = '\3';
}
return {
	capitalize = function(str)
		return string.upper(string.sub(str, 1,1)) .. string.sub(str, 2)
	end;






	explode = function(str,delim)





		local i = 1
		local tbl = {}

		repeat
			local ss = string.sub(str, i)










			local d = string.find(ss, delim, 1, true) or string.len(ss)+1






			tbl[#tbl+1] = string.sub(ss,1,d-1)
			i = i + d 

		until i > string.len(str)
		return tbl
	end;

	rand = function(min,max)
		if not min then min = 16  end
		if not max then max = min end







>
>
>
>
>
|
>
>
>
>
>


>


>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
<
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
	['\xf3'] = '\3';
}
return {
	capitalize = function(str)
		return string.upper(string.sub(str, 1,1)) .. string.sub(str, 2)
	end;

	beginswith = function(str,pfx)
		if #str < #pfx then return false end
		return string.sub(str,1,#pfx) == pfx
	end;

	endswith = function(str,sfx)
		if #str < #sfx then return false end
		return string.sub(str,#sfx) == sfx
	end;

	explode = function(str,delim,pat) -- this is messy as fuck but it works so im keeping it
		local i = 1
		local tbl = {}
		if pat == nil then pat = false end
		repeat
			local ss = string.sub(str, i)
			local d
			if pat then
				local matches = {string.match(ss, '()' .. delim .. '()')}
				if #matches > 0 then
					local start,stop = matches[1], matches[#matches]
					d = start
					i = i + stop - 1
				end
			else
				local dl = string.len(delim)
				d = string.find(ss, delim, 1, not pat)
				if d then i = i + d + dl - 1 end
			end
			if not d then
				tbl[#tbl+1] = string.sub(ss,1,string.len(ss))
				break
			else
				tbl[#tbl+1] = string.sub(ss,1,d-1)

			end
		until i > string.len(str)
		return tbl
	end;

	rand = function(min,max)
		if not min then min = 16  end
		if not max then max = min end