-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
43 lines (38 loc) · 1.43 KB
/
main.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
-- Set our base require paths.
love.filesystem.setRequirePath("?.lua;?/init.lua;lib/?.lua;lib/?/init.lua")
love.filesystem.setCRequirePath("??;lib/??")
-- Import LPeg for current platform, fallback to LuLPeg.
do
-- Set up native require paths (for LPeg).
local os = require'love'.system.getOS()
local c_require_path = love.filesystem.getCRequirePath()
if os == "OS X" then
print "setting LPeg require path for macOS ARM"
love.filesystem.setCRequirePath(c_require_path .. ";lib/macOS_arm/??")
-- If it doesn't load, try x64 architecture instead. Stupid hack.
local success = pcall(require, "lpeg")
if not success then
print "setting LPeg require path for macOS x64"
love.filesystem.setCRequirePath(c_require_path .. ";lib/macOS_x64/??")
end
elseif os == "Windows" then
print "setting LPeg require path for Windows x64"
love.filesystem.setCRequirePath(c_require_path .. ";lib/win32_x64/??")
else
print "WARNING: Supply LPeg .so for your platform here!"
end
-- Import LPeg
local success, lpeg = pcall(require, "lpeg")
if success then
print("LPeg loaded successfully.")
else
print("WARNING: Falling back to LuLPeg. Some MoonScript features may not work!")
lpeg = require("lulpeg"):register(not _ENV and _G)
end
end
-- Import the MoonScript loader.
require "moonscript"
-- Import our custom error handler.
require "errorhandler"
-- Import the actual game code.
require "game"