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
  • Path Functions

ComparePaths

Available since Version 1.7.

Compares two paths with options to ignore different casing and different slashes.

Syntax

ComparePaths( path1, path2, [case_insensitive, slash_insensitive] )

Arguments

  • path1 (string): The first path.
  • path2 (string): The second path.
  • case_insensitive (boolean): Whether or not the comparison is case insensitive.
    • Optional, defaults to true.
  • slash_insensitive (boolean): Whether or not the comparison is slash insensitive.
    • Optional, defaults to true.

Return Values

  • (boolean): Whether the paths match.

Examples

-- Result is true
local Result = ComparePaths("art\\cars\\famil_v.p3d", "art/cars/famil_v.p3d")

-- Result is false, the capitalization is different.
local Result = ComparePaths("ART\\CARS\\FAMIL_V.p3d", "art/cars/famil_v.p3d", false)

-- Result is false, the slashes are different.
local Result = ComparePaths("ART\\CARS\\FAMIL_V.p3d", "ART/CARS/FAMIL_V.p3d", true, false)

Version History

Version 1.19

Fixed an issue where the ComparePaths function was always case sensitive and always slash sensitive.