Add startable legacy code

This commit is contained in:
Cooldude2606
2024-09-22 23:38:58 +01:00
parent 65145b5d34
commit 2a1206c498
163 changed files with 756 additions and 2573 deletions

View File

@@ -4,8 +4,8 @@
@alias Common
]]
local Colours = require 'utils.color_presets' --- @dep utils.color_presets
local Game = require 'utils.game' --- @dep utils.game
local Colours = require("modules/exp_util/include/color")
local Game = require("modules.exp_legacy.utils.game") --- @dep utils.game
local Common = {}
@@ -138,21 +138,12 @@ end
--- Will raise an error if called during runtime
-- @usage error_if_runtime()
function Common.error_if_runtime()
if _LIFECYCLE == 8 then
if package.lifecycle == 8 then
local function_name = debug.getinfo(2, 'n').name or '<anon>'
error(function_name..' can not be called during runtime', 3)
end
end
--- Will raise an error if the function is a closure
-- @usage error_if_runetime_closure(func)
function Common.error_if_runetime_closure(func)
if _LIFECYCLE == 8 and Debug.is_closure(func) then
local function_name = debug.getinfo(2, 'n').name or '<anon>'
error(function_name..' can not be called during runtime with a closure', 3)
end
end
--- Value Returns.
-- @section valueReturns
@@ -255,7 +246,7 @@ local file_path = get_file_path()
]]
function Common.get_file_path(offset)
offset = offset or 0
return debug.getinfo(offset+2, 'S').source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
return debug.getinfo(offset+2, 'S').short_src:sub(10, -5)
end
--[[-- Converts a table to an enum