From ad70ae5a507960223f9ef0a4f53a0ed02216ead4 Mon Sep 17 00:00:00 2001 From: Avril112113 Date: Wed, 24 Apr 2024 09:26:55 +0100 Subject: [PATCH] Added LuaJIT check and binary extension `.so` support. Linux binaries not provided yet. --- main.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 534ec5b..0e39df1 100644 --- a/main.lua +++ b/main.lua @@ -12,8 +12,14 @@ do end end +jit = jit or select(2, pcall(require, "jit")) +if not jit then + print("Must be run with LuaJIT, not " .. _VERSION) + os.exit(-1) +end +local binary_ext = jit.os == "Windows" and "dll" or "so" package.path = ("{TP}/?.lua;{TP}/?/init.lua;{SSP}/libs/?.lua;{SSP}/libs/?/init.lua;{SSP}/?.lua;{SSP}/?/init.lua;"):gsub("{TP}", TOOL_PATH):gsub("{SSP}", SELENSCRIPT_PATH) -package.cpath = ("{TP}/?.dll;{SSP}/libs/?.dll;"):gsub("{TP}", TOOL_PATH):gsub("{SSP}", SELENSCRIPT_PATH) +package.cpath = ("{TP}/?.{EXT};{SSP}/libs/?.{EXT};"):gsub("{TP}", TOOL_PATH):gsub("{SSP}", SELENSCRIPT_PATH):gsub("{EXT}", binary_ext) local CLI = require "tool.cli"