# lib_ini function library

Dependencies: lib_2da, lib_anon, lib_array, lib_fn, lib_sfo, lib_sugar, lib_tools, lib_ui

## Description

Functions to interact with ini files. (Probably quite short, since once we've read them in we can use array tools.)

## Public functions

check_ini(silent:i, ini:s, arguments:s, section:s)=(value:s) dimorphic

Legacy name for ini_check.

ini_check(silent:i, ini:s, arguments:s, section:s)=(value:s) dimorphic

Return a value from the mod's ini (which needs to have previously been read in, as a flat ini, into SFO_reserved_ini_hash). If 'section' is set, instead return a section-dependent value from the ini (it needs to have previously been read into SFO_reserved_ini_hash_2d). If the ini doesn't contain that value, whine unless silent=1. ini and arguments are synonyms.

ini_load action_macro

ini_read(backwards:b, flat:b, case:[upper|lower], section:s)=(array:a, section_array:a) patch
ini_read(backwards:b, flat:b, file:s, section:s, path:s, location:s, locbase:s, case:[upper|lower])=(array:a, section_array:a) action

Read in a file, or in patch context this file, in the 'ini' format. By default, store it in a 2d array (section,key)-> value. If 'flat' is set, instead store it as key=>value, ignoring sections. If 'backwards' is set, swap key and value. if 'case' is set, force the key and value into upper or lower case. Also return a k=>_ array 'section_array' of section keys. If "section" is set, return only entries in the 'section' section (this automatically sets flat=1).

In action context, if path,location, and locbase are all blank, assume an in-game ini file.

Ini entries wrapped in "" will have them stripped.

ini_to_2da(ini:s, location:s, locbase:s, path:s, 2da_path:s, 2da:s, defaults:s, main_default:s="*", first_column:s, force_columns:s)=() action

ini_write(array:s)=() patch
ini_write(file:s, path:s, location:s, locbase:s, array:s)=() action