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

FixSlashes

Available since Version 1.8.

Returns a version of the given path with modified slashes.

Syntax

FixSlashes( path, [to_windows, from_windows])

Arguments

  • path (string): The path to modify.
  • to_windows (boolean): Whether to convert the path to have back slashes (\).
  • from_windows (boolean): Whether to convert the path to have forward slashes (/).

Return Values

  • (string): The fixed path.

Examples

--- Returns "scripts/missions/level01/level.mfk"
local Path1 = FixSlashes("scripts\\missions\\level01\\level.mfk", false, true)

--- Returns "scripts\missions\level01\level.mfk"
local Path2 = FixSlashes("scripts/missions/level01/level.mfk", true, false)

Notes

Only one of the 2nd and 3rd arguments should be set to true.