Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Modding Tools
  • Lucas' Simpsons Hit & Run Mod Launcher
  • Hacks
  • Mod Requirable Hacks
  • Custom Files
  • Lua Functions
  • General Functions

GetLauncherVersion

Available since Version 1.19.

Returns the current version of the Mod Launcher as a string.

Syntax

GetLauncherVersion()

Arguments

No arguments.

Return Values

  • (string): The version number of the mod launcher.

Examples

-- Separates a version string into a table of numbers.
function GetVersionParts(Version)
	local tbl = {}
	
    for part in Version:gmatch("[^%.]+") do
       tbl[#tbl + 1] = tonumber(part)
	end
	
    return tbl
end

-- Compares version table.
-- Returns positive is Version1 is newer, negative is Version1 is older or 0 if equal.
function CompareVersion(Version1, Version2)
	local Part1, Part2
	
    for i = 1, math.max(#Version1, #Version2) do
        Part1 = Version1[i] or 0
        Part2 = Version2[i] or 0
        
        if Part1 < Part2 then return -1 end
        if Part1 > Part2 then return 1 end
	end
	
    return 0
end

local LauncherVersion = GetLauncherVersion()

-- IsOldVersion will be true if launcher version is before 1.23.9
IsOldVersion = CompareVersion(GetVersionParts(LauncherVersion), {1, 23, 9}) < 0