mirror of
https://codeberg.org/1414codeforge/crush.git
synced 2024-12-12 09:56:03 +01:00
[crush] Add Lua version compatibility check.
This commit is contained in:
parent
7687b1d06e
commit
1e19ea0290
27
crush.lua
27
crush.lua
@ -7,6 +7,33 @@
|
||||
local io = require 'io'
|
||||
local os = require 'os'
|
||||
|
||||
-- Lua version check
|
||||
|
||||
local function check_version()
|
||||
-- Generic Lua version check - 5.2 required
|
||||
if _VERSION then
|
||||
local maj, min = _VERSION:match("Lua (%d+)%.(%d+)")
|
||||
|
||||
if maj and min then
|
||||
maj, min = tonumber(maj), tonumber(min)
|
||||
if maj > 5 or (maj == 5 and min >= 2) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- LuaJIT check - 2.0.0 required (technically 2.0.0_beta11)
|
||||
if jit and jit.version_num and jit.version_num >= 20000 then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if not check_version() then
|
||||
error("Unsupported Lua version!\nSorry, crush requires Lua 5.2 or LuaJIT 2.0.0.")
|
||||
end
|
||||
|
||||
-- System specific functions
|
||||
--
|
||||
-- Portions of this code are based on work from the LuaRocks project.
|
||||
|
Loading…
Reference in New Issue
Block a user