Skip to content

ReadConfig

The ReadConfig function reads a configuration file from the configs directory within the scripts folder. The configuration files in the Ghost system are simply tables that are heavily encrypted, ensuring total safety of the data. These files cannot be read in plain text or scanned by an outside program, providing a high level of security.

Parameters

  • fileName: The name of the configuration file to read. The file must be located in the configs directory where the Ghost executable file is.

Returns

  • configTable: A table containing the decrypted configuration data.

Example Usage in Lua

Here is an example of how to use the ReadConfig function in Lua:

local api = ...

-- Function to read a configuration file and print its contents
function ReadAndPrintConfig(fileName)
    local configTable = api.ReadConfig(fileName)
    if configTable then
        for key, value in pairs(configTable) do
            print(key, value)
        end
    else
        print("Failed to read config file: " .. fileName)
    end
end

-- Example usage: Read and print the contents of "exampleConfig.ghost"
ReadAndPrintConfig("exampleConfig.ghost")