From Multi Theft Auto: Wiki

This function transform a path that is passed to it into a path that is relative to the translators current directory. The path must be accessible from the translator. The path can either be absolute or relative.


string translator.relPath ( string path )


  • path: the path that should be transformed into a relative path; can be nil if the current directory should be returned


This function returns the relative version of the path that is passed to it, false if the specified path is not accessible by the translator.


Click to collapse [-]

This snippet converts the path relative from one translator to a relative path from another translator.

local function getPathTranslatorRelative( srcTranslator, dstTranslator, srcPath )
    -- Get the absolute path from the srcTranslator perspective.
    local absPath = srcTranslator.absPath( srcPath );

    -- Return the relative path from the dstTranslator. Will return false if conversion cannot happen.
    return dstTranslator.relPath( absPath );

FileSystem Translator Functions