Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions croissant/do.lua
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,7 @@ local function appendToDebugHistory(code)
end
end

local function luaVersion()
local f = function()
return function()
end
end

local t = {
nil,
[false] = "Lua 5.1",
[true] = "Lua 5.2",
[1/"-0"] = "Lua 5.3",
[1] = "LuaJIT"
}

return t[1] or t[1/0] or t[f() == f()]
end

local function banner()
local version = luaVersion()

if tonumber(_VERSION:match("Lua (%d+)")) < 5
or tonumber(_VERSION:match("Lua %d+%.(%d+)")) < 1 then
print(colors.red "Croissant requires at least Lua 5.1")
Expand All @@ -347,9 +328,9 @@ local function banner()

print(
"🥐 Croissant 0.0.1 (C) 2019 Benoit Giannangeli\n"
.. version .. (version:match "^LuaJIT"
and " Copyright (C) 2005-2017 Mike Pall. http://luajit.org/"
or " Copyright (C) 1994-2018 Lua.org, PUC-Rio")
.. (type(jit) == "table"
and jit.version
or ("PUC-Rio " .. _VERSION))
)
end

Expand Down