This file is indexed.

/usr/share/games/instead/stead/vars.lua is in instead-data 1.9.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 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
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
function isForSave(k, v, s) -- k - key, v - value, s -- parent table
	local i,o
	if type(s.variables_save) == 'table' and 
		s.variables_save[k] then
			return true
	end
	if type(k) == 'function' then
		return false
	end
	if type(v) == 'function' or type(v) == 'userdata' then
		return false
	end
	if type(k) ~= 'string' then
		return false
	end
	return stead.string.find(k, '_') ==  1
end

local function __vars_add(s, v, set)
	local k, o
	if type(s.variables) ~= 'table' then s.variables = {} end
	for k,o in pairs(v) do
		if tonumber(k) then
			stead.table.insert(s.variables, o);
		elseif s.variables[k] then
			error ("Variable overwrites variables object: "..tostring(k))
		elseif k ~= 'variable_type' then
			if set and not isObject(o) then 
				if s[k] then
					if s == _G then
						print ("Global variable '"..tostring(k).."' conflicts with "..type(s[k]));
					else
						error ("Variable conflict: "..tostring(k));
					end
				end
				stead.table.insert(s.variables, k);
				s[k] = o
			else
				s.variables[k] = o
			end
		end
	end
end

local function __vars_fill(v)
	local k,o
	if type(v) ~= 'table' then
		return
	end
	for k,o in ipairs(v) do
		if type(o) == 'table' and o.variable_type then
			__vars_add(v, o);
			v[k] = false
		end
	end
	if type(v.variables) == 'table' then
		local k,o
		local vars = {}
		v.variables_save = {}
		for k,o in pairs(v.variables) do
			if tonumber(k) and type(o) == 'string' then
				stead.table.insert(vars, o)
			else
				if v[k] then
					error ("Variable overwrites object property: "..tostring(k));
				end
				v[k] = o
				stead.table.insert(vars, k);
			end
		end
		for k,o in ipairs(vars) do
			v.variables_save[o] = true
		end
		v.variables = vars;
	end
end

vars_object = obj {
	nam = 'vars',
	system_type = true,
	ini = function(s)
		__vars_fill(_G)
		__vars_fill(pl)
		__vars_fill(game)
	end
}

obj = stead.hook(obj, 
function(f, v, ...)
	__vars_fill(v)
	return f(v, ...)
end)

stead.add_var = function(s, v) 
	if not v then 
		v = s 
		s = _G 
	end
	if type(v) ~= 'table' then
		error("Wrong parameter to stead.add_var.");
	end
	if not v.variable_type then
		v = var(v)
	end
	__vars_add(s, v, true)
	__vars_fill(s)
end

stead.module_init(function()
	local k,v
	if type(variables) == 'nil' then
		variables = {}
		return
	end 
	if type(variables) ~= 'table' then
		return
	end
	for k,v in ipairs(variables) do
		_G[v] = nil
	end
	variables = {}
end)

function var(v)
	v.variable_type = true
	return v
end

function global(v)
	if type(v) ~= 'table' then
		error("Wrong parameter to global.", 2);
	end
	__vars_add(_G, v, true);
end
-- vim:ts=4