-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.lua
More file actions
68 lines (53 loc) · 1.71 KB
/
setup.lua
File metadata and controls
68 lines (53 loc) · 1.71 KB
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
--[[
Copyright (C) 2011-2021 G. Bajlekov
Ivy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Ivy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
package.path = './?.lua;./?/init.lua;' .. package.path
assert(jit, "LuaJIT is required")
-- disable stdout buffer
io.stdout:setvbuf('no')
-- set up debugging link if enabled
if os.getenv('DEBUG_MODE') then
require 'debugger'()
require 'debugger.plugins.ffi'
end
-- optimize parameters
jit.opt.start("sizemcode=8000")
-- start profiler
--require("jit.p").start("Fl5-5i1m1v", "profile.txt")
--require("jit.v").start("verbose.txt")
--require("jit.dump").start("tbT", "dump.txt")
--debug.see(jit)
-- prevent global definitions
do
function _G.global(k, v) -- assign new global
rawset(_G, k, v or false)
end
local function newGlobal(t, k, v) -- disable globals
print(debug.traceback())
error("global assignment not allowed: "..k)
end
setmetatable(_G, {__newindex = newGlobal})
end
-- helper functions
function table.empty(t) return next(t) == nil end
function table.copy(i)
local o = {}
for k, v in pairs(i) do
o[k] = v
end
return o
end
require "tools.math"
love.filesystem.setIdentity("Ivy")
-- expand debug library
require "tools.debug"