# Note: this ini filter does not filter by section. Can cause issues with some games that have multiple sections with the same variable name.
fn_info_game_ini(){
# sed is used to process the file.
# -n option tells sed to suppress output by default.
# /^[[:space:]]*${2}/ is a pattern match that looks for lines that start with optional whitespace followed by the value of $2.
# s/.*= *// is a substitution command that removes everything up to and including the equals sign (including optional spaces) in the matching line.
# "\?\([^"]*\)"\? matches an optional double quote, followed by any number of non-quote characters (captured in a group), followed by another optional double quote. This allows for values that are either quoted or not to be displayed.
# p at the end of the s command tells sed to print the resulting line if there was a match.
# q at the end of the s command tells sed to quit after the first match.
# tr -d '\r' removes CRLF carriage returns from the end of the line.
# -n is an option that tells sed to suppress the default output behavior, meaning it will not automatically print every line of input.
# '/^[[:space:]]*\<'"${2}"'\>/ is a regular expression pattern enclosed within single quotes. It will be used to match lines of input.
# ^ indicates the beginning of a line.
# [[:space:]]* matches any whitespace characters (spaces or tabs) zero or more times.
# \< and \> are word boundaries, ensuring that the pattern matches whole words.
# "${2}" is an example of variable substitution, where the value of the second argument passed to the script will be inserted. In this case, it will be a regular expression pattern specified when executing the sed command.
# { s/.*= *"\?\([^"]*\)"\?/\1/p;q } is a block of commands enclosed within curly braces that will be executed when a line matches the pattern.
# s/.*= *"\?\([^"]*\)"\?/\1/ is a substitution command that replaces the entire line with the content within the quotes.
# .*= matches any characters (except newline) followed by an equal sign.
# * matches zero or more spaces after the equal sign.
# "\?\([^"]*\)"\? captures the content within the quotes and stores it in a group.
# \"? matches a double quote character zero or one time.
# \([^"]*\) captures any characters (except double quotes) zero or more times and stores them in a group.
# \"? matches a double quote character zero or one time.
# \1 refers to the first captured group from the pattern, which is the content within the quotes.
# p is a command that prints the modified pattern space (the result of the substitution).
# q is a command that quits the sed script, preventing further processing of input lines.
# -n option tells sed to suppress output by default.
# s/: indicates that the command is a substitution command.
# ^.* matches any number of characters from the beginning of the line.
# ${2} matches the literal string "${2}".
# \s matches any whitespace character.
# \+ matches one or more occurrences of the preceding whitespace character (in this case, the previous \s).
# "\(.*\)" matches any characters enclosed in double quotes and captures them in a group, denoted by the escaped parentheses.
# /\1/ indicates that the substitution should replace the matched string with the contents of the first (and only) captured group, denoted by \1.
# p at the end of the s command tells sed to print the resulting line if there was a match.
# q at the end of the s command tells sed to quit after the first match.
# sed is the command itself, indicating that we want to use the sed utility.
# -n is an option that tells sed to suppress the default output behavior, meaning it will not automatically print every line of input.
# '/^[[:space:]]*${2}[[:space:]]*\"\?\(.*\)\?\"/' is a regular expression pattern enclosed within single quotes. It will be used to match lines of input.
# ^ indicates the beginning of a line.
# [[:space:]]* matches any whitespace characters (spaces or tabs) zero or more times.
# ${2} is an example of variable substitution, where the value of the second argument passed to the script will be inserted. In this case, it will be a regular expression pattern specified when executing the sed command.
# \"?\(.*\)\?\" is another regular expression pattern within double quotes.
# \"? matches a double quote character zero or one time.
# \(.*\) captures any characters (except newline) zero or more times and stores them in a group.
# \?\" matches a double quote character zero or one time.
# { s//\1/p;q } is a block of commands enclosed within curly braces that will be executed when a line matches the pattern.
# s//\1/ is a substitution command without specifying the search pattern. The empty search pattern indicates that it should use the previously matched pattern from the pattern space. The \1 is a reference to the first captured group from the pattern.
# p is a command that prints the modified pattern space (the result of the substitution).
# q is a command that quits the sed script, preventing further processing of input lines.
# -n option tells sed to suppress output by default.
# s/ indicates that the command is a substitution command.
# -n is an option that tells sed to suppress the default output behavior, meaning it will not automatically print every line of input.
# '/^[[:space:]]*\<'"${2}"'\>/ is a regular expression pattern enclosed within single quotes. It will be used to match lines of input.
# ^ indicates the beginning of a line.
# [[:space:]]* matches any whitespace characters (spaces or tabs) zero or more times.
# \< and \> are word boundaries, ensuring that the pattern matches whole words.
# "${2}" is an example of variable substitution, where the value of the second argument passed to the script will be inserted. In this case, it will be a regular expression pattern specified when executing the sed command.
# { s/.*= *"\?\([^"]*\)"\?/\1/p;q } is a block of commands enclosed within curly braces that will be executed when a line matches the pattern.
# s/.*= *"\?\([^"]*\)"\?/\1/ is a substitution command that replaces the entire line with the content within the quotes.
# .*= matches any characters (except newline) followed by an equal sign.
# * matches zero or more spaces after the equal sign.
# "\?\([^"]*\)"\? captures the content within the quotes and stores it in a group.
# \"? matches a double quote character zero or one time.
# \([^"]*\) captures any characters (except double quotes) zero or more times and stores them in a group.
# \"? matches a double quote character zero or one time.
# \1 refers to the first captured group from the pattern, which is the content within the quotes.
# p is a command that prints the modified pattern space (the result of the substitution).
# q is a command that quits the sed script, preventing further processing of input lines.
# Note: this ini filter does not filter by section. Can cause issues with some games that have multiple sections with the same variable name.
fn_info_game_lua(){
# sed is used to process the file.
# -n is an option that tells sed to suppress the default output behavior, meaning it will not automatically print every line of input.
# '/^[[:space:]]*\<'"${2}"'\>/ is a regular expression pattern enclosed within single quotes. It will be used to match lines of input.
# ^ indicates the beginning of a line.
# [[:space:]]* matches any whitespace characters (spaces or tabs) zero or more times.
# \< and \> are word boundaries, ensuring that the pattern matches whole words.
# "${2}" is an example of variable substitution, where the value of the second argument passed to the script will be inserted. In this case, it will be a regular expression pattern specified when executing the sed command.
# { s/.*= *"\?\([^"]*\)"\?/\1/p;q } is a block of commands enclosed within curly braces that will be executed when a line matches the pattern.
# s/.*= *"\?\([^"]*\)"\?/\1/ is a substitution command that replaces the entire line with the content within the quotes.
# .*= matches any characters (except newline) followed by an equal sign.
# * matches zero or more spaces after the equal sign.
# "\?\([^"]*\)"\? captures the content within the quotes and stores it in a group.
# \"? matches a double quote character zero or one time.
# \([^"]*\) captures any characters (except double quotes) zero or more times and stores them in a group.
# \"? matches a double quote character zero or one time.
# \1 refers to the first captured group from the pattern, which is the content within the quotes.
# p is a command that prints the modified pattern space (the result of the substitution).
# q is a command that quits the sed script, preventing further processing of input lines.