-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_cliSugar.lua
136 lines (118 loc) · 2.45 KB
/
_cliSugar.lua
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
136
-- CLI sugar file
--
-- please don't use this - it defines some game functions in a poor way so that the demos
-- can run on the command line. It's ugly.
--
function Class(members, baseClass)
members = members or {}
local __index = members
local mt = {
__metatable = members,
__index = __index
}
if baseClass ~= nil then
setmetatable(members, {
__index = baseClass
})
end
local function new(_, init)
return setmetatable(init or {}, mt)
end
local function copy(obj, ...)
local newobj = obj.new(unpack(arg))
for n, v in pairs(obj) do
newobj[n] = v
end
return newobj
end
function members:class()
return members
end
function members:superClass()
return baseClass
end
function members:isa(other)
local curClass = members
while curClass ~= nil do
if curClass == other then
return true
else
curClass = curClass:superClass()
end
end
return false
end
members.new = members.new or new
members.copy = members.copy or copy
return mt
end
FSCareerMissionInfo = {
}
Utils = {
getNoNil = function (value, setTo)
if value == nil then
return setTo
end
return value
end,
appendedFunction = function(old, new)
return old
end
}
function printError(text)
local c27 = string.char(27)
print(c27 .. '[1;31m' .. text .. c27 .. '[0m')
end
function printWarning(text)
local c27 = string.char(27)
print(c27 .. '[1;33m' .. text .. c27 .. '[0m')
end
function getUserProfileAppPath()
return "./"
end
function fileExists(_)
return true
end
function createXMLFile(_, name, _)
return name
end
function saveXMLFile(_)
return true
end
function loadXMLFile(_, name)
return name
end
function setXML(type, file, key, value)
print("SetXML:" .. type .. ":" .. file .. "::" .. key .. "::" .. tostring(value))
end
function setXMLFloat(file, key, value)
setXML("float", file, key, value)
end
function setXMLInt(file, key, value)
setXML("int", file, key, value)
end
function setXMLString(file, key, value)
setXML("string", file, key, value)
end
function setXMLBool(file, key, value)
setXML("bool", file, key, value)
end
function getXML(type, file, key)
print("GetXML:" .. type .. ":" .. file .. "::" .. key)
return nil
end
function getXMLInt(file, key)
return getXML("int", file, key)
end
function getXMLFloat(file, key)
return getXML("float", file, key)
end
function getXMLBool(file, key)
return getXML("bool", file, key)
end
function getXMLString(file, key)
return getXML("string", file, key)
end
function delete(_)
return
end