Class ini_file

Implementation of streaming ini file container. Allows reading / writing field in file by section/field.

Supports custom extension with section overriding and custom #include statements.

Source

C++ class ini_file

Custom Constructor

ini_file

Hierarchy

  • ini_file

Constructors

  • Returns ini_file

  • Create ini file representation based on file name. Full path is limited to 520 chars.

    Parameters

    • path: string

      file name and relative path to gamedata configs folder

    Returns ini_file

  • Create ini file representation based on file name. Full path is limited to 520 chars.

    Parameters

    • initial: string

      base to count relative path from, $game_data$ is an example

    • path: string

      file name and relative path from initial entrypoint

    Returns ini_file

Methods

  • Get file name and path of ini file.

    Returns string

    full path to ini file

    Example

    `f:\applications\steam\steamapps\common\stalker call of pripyat\gamedata\configs\misc\task_manager.ltx`
    
  • Parameters

    • section: string

      target section to check lines count

    Returns number

    count of lines for provided section

  • Check if line exists in the file by section and field.

    Parameters

    • section: string

      target section to check

    • field: string

      section field to check

    Returns boolean

    whether line exists

  • Parameters

    • section: string
    • field: string

    Returns boolean

  • Parameters

    • section: string
    • field: string

    Returns number

  • Parameters

    • section: string
    • field: string

    Returns number

  • Read text line from ini config file.

    Type Parameters

    • T extends string = string

    • P extends string = string

    Parameters

    • section: string
    • line_number: number
    • c: string
    • d: string

    Returns LuaMultiReturn<[boolean, T, P]>

    tuple with three elements, where first is success status, second is key, third is value.

  • Parameters

    • section: string
    • field: string

    Returns number

  • Parameters

    • section: string

      ini file section

    • field: string

      ini section field

    Returns string

    raw string from ltx file without spaces in it

  • Parameters

    • section: string

      ini file section

    • field: string

      ini section field

    Returns string

    if quoted, parsed string data inside quotes including spaces, else is same data as with r_string

  • Parameters

    • section: string
    • field: string

    Returns string

  • Parameters

    • section: string
    • field: string

    Returns number

  • Remove ini file section field.

    Parameters

    • section: string

      target section to modify

    • field: string

      target section field to remove

    Returns void

  • Adjust saving on file closing/destructor calls.

    Parameters

    • should_save: boolean

      whether ini file should be saved when destructor is called

    Returns void

  • Parameters

    • section: string

    Returns boolean

  • Iterate over ini file sections. Calls provided callback for each ini section in file.

    Parameters

    • cb: ((this, name) => void)

      callback to call on each ini file section, where name is section name

        • (this, name): void
        • Parameters

          • this: void
          • name: string

          Returns void

    Returns void

  • Parameters

    • override: boolean

    Returns void

  • Parameters

    • is_readonly: boolean

    Returns void

  • Parameters

    • section: string
    • field: string
    • bool: boolean
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • color: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • color: fcolor
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • float: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • vector: vector2
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • vector: vector
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • vector: never
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • sshort: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • sint: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • sint: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • uchar: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • string: string
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • ushort: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • uint: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • uint: number
    • Optional comment: string

    Returns void

  • Parameters

    • section: string
    • field: string
    • uchar: number
    • Optional comment: string

    Returns void

Generated using TypeDoc