@amxts/config-core 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/include/universal_config.inc +355 -355
- package/package.json +2 -2
- package/prebuilt/linux/config-core.aot +0 -0
- package/prebuilt/manifest.json +20 -19
- package/prebuilt/windows/config-core.aot +0 -0
- package/src/natives.ts +271 -271
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amxts/config-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "Configs in INI, YAML or JSON for amxts plugins, read into typed objects and written back - and the cfg_* natives for Pawn plugins.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "kukson777",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"lint:fix": "oxfmt && oxlint --fix --silent || oxlint --fix --silent || oxlint --fix"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@amxts/core": "^0.
|
|
48
|
+
"@amxts/core": "^0.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@e18e/eslint-plugin": "^0.8.1",
|
|
Binary file
|
package/prebuilt/manifest.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"format":
|
|
2
|
+
"format": 2,
|
|
3
3
|
"module": "@amxts/config-core",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"from": {
|
|
6
6
|
"@amxts/core": {
|
|
7
|
-
"version": "0.
|
|
8
|
-
"hash": "
|
|
7
|
+
"version": "0.3.0",
|
|
8
|
+
"hash": "1930bb0d9b7e1fa4857f2a6a4a011df0fbcb63ca",
|
|
9
|
+
"abi": "0.3.0+abi.1ff73017\nArrayCreate (ii)i\nArrayPushArray (iii)i v,[a2,v\nArrayPushCell (ii)i\nArrayPushString (ii)i v,s leaf\nLookupLangKey (iiii)i t,v,s,[1 leaf\nabort (iiii)\namxts_rpc_reply (ii)\namxts_rpc_take (i)\namxts_serve (ii)\narg (i)i\narg_array (iii)i\narg_string (iii)i\narg_text (iii)i\ncall (iiii)i\nclcmd (iiii)\nconsole.error (i)\nconsole.log (i)\ncreate_cvar (iiiiiiii)i s,s,v,s,v,v,v,v\ncvar_hook (ii)i\ndir_exists (ii)i s,v leaf\nexport (ii)i\nfclose (i)i\nfile_exists (ii)i s,v leaf\nfopen (iiii)i s,s,v,s leaf\nfputs (iii)i v,s,v leaf\nfread_blocks (iiii)i v,[n1>,v,v\nget_cvar_pointer (i)i s leaf\nget_localinfo (iii)i s,t,v leaf\nget_user_flags (ii)i\nget_user_msgid (i)i s leaf\nham (iiii)i\nhook_on (ii)\nmkdir (iiii)i s,v,v,s leaf\nmsg_hook (ii)i\non (iii)\non_direct (iiiiii)\noutcome (i)\nplayer_data_set (iiF)\nplayer_names (i)\nplayer_slots (i)\nplugin (iiii)\nprecache_generic (i)i s\nprecache_model (i)i s\nprecache_sound (i)i s\nprint_client (iii)\nread_args (ii)i t,v leaf\nread_argv (iii)i v,t,v leaf\nregister_dictionary (i)i s leaf\nsay_text (iii)\nset_arg_text (iii)i\nstack_frames (ii)i\ntag (i)"
|
|
9
10
|
},
|
|
10
11
|
"@amxts/config-core": {
|
|
11
|
-
"version": "0.
|
|
12
|
-
"hash": "
|
|
12
|
+
"version": "0.2.0",
|
|
13
|
+
"hash": "fc3b2c2731f6044d4ce8dab8fe1471b4441ad8c9"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
16
|
"options": {
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
}
|
|
57
58
|
],
|
|
58
59
|
"result": "int",
|
|
59
|
-
"doc": "/**\
|
|
60
|
+
"doc": "/**\n * Loads a config file from `configs/<base dir>/`; \".ini\" is added when the\n * name has none. A file that is not there still gets a handle, empty.\n */",
|
|
60
61
|
"layout": [
|
|
61
62
|
{
|
|
62
63
|
"param": {
|
|
@@ -168,7 +169,7 @@
|
|
|
168
169
|
}
|
|
169
170
|
],
|
|
170
171
|
"result": "string?",
|
|
171
|
-
"doc": "/**\
|
|
172
|
+
"doc": "/**\n * The value of a key, or of a path (\"block/subkey\"), into value[]; index is\n * the value's place in its line. false when there is none.\n */",
|
|
172
173
|
"layout": [
|
|
173
174
|
{
|
|
174
175
|
"param": {
|
|
@@ -650,7 +651,7 @@
|
|
|
650
651
|
}
|
|
651
652
|
],
|
|
652
653
|
"result": "array",
|
|
653
|
-
"doc": "/**\
|
|
654
|
+
"doc": "/**\n * The words of a key's line (index: which line, when the key is there more\n * than once); for a block, every value of every row. The caller destroys the\n * array; Invalid_Array when there are no words.\n */",
|
|
654
655
|
"layout": [
|
|
655
656
|
{
|
|
656
657
|
"param": {
|
|
@@ -823,7 +824,7 @@
|
|
|
823
824
|
}
|
|
824
825
|
],
|
|
825
826
|
"result": "array",
|
|
826
|
-
"doc": "/**\
|
|
827
|
+
"doc": "/**\n * Every value of the line a path leads to (lineIndex: the row of a block), as\n * written. The caller destroys the array.\n */",
|
|
827
828
|
"layout": [
|
|
828
829
|
{
|
|
829
830
|
"param": {
|
|
@@ -954,7 +955,7 @@
|
|
|
954
955
|
}
|
|
955
956
|
],
|
|
956
957
|
"result": "array",
|
|
957
|
-
"doc": "/**\
|
|
958
|
+
"doc": "/**\n * The whole section, as an array of three: the keys, the values (an array of\n * strings per key, \"{block}\" for a block) and [key, value] index pairs.\n */",
|
|
958
959
|
"layout": [
|
|
959
960
|
{
|
|
960
961
|
"param": {
|
|
@@ -1865,7 +1866,7 @@
|
|
|
1865
1866
|
}
|
|
1866
1867
|
],
|
|
1867
1868
|
"result": "bool",
|
|
1868
|
-
"doc": "/**\
|
|
1869
|
+
"doc": "/**\n * Writes one section to a file; the file's other sections are not in it.\n * With cfg = CFG_FILE_INVALID the section is looked for in every loaded file.\n */",
|
|
1869
1870
|
"layout": [
|
|
1870
1871
|
{
|
|
1871
1872
|
"param": {
|
|
@@ -1944,7 +1945,7 @@
|
|
|
1944
1945
|
}
|
|
1945
1946
|
],
|
|
1946
1947
|
"result": "bool",
|
|
1947
|
-
"doc": "/**\
|
|
1948
|
+
"doc": "/**\n * Saves every section of the file with the comments it was read with. The\n * file name has to be given: without one it returns false.\n */",
|
|
1948
1949
|
"layout": [
|
|
1949
1950
|
{
|
|
1950
1951
|
"param": {
|
|
@@ -2128,7 +2129,7 @@
|
|
|
2128
2129
|
}
|
|
2129
2130
|
],
|
|
2130
2131
|
"result": "bool",
|
|
2131
|
-
"doc": "/**\
|
|
2132
|
+
"doc": "/**\n * The comment line written above row `row` of the block `key` - \"; ID | VALUE\",\n * say; \"\" removes it. false when there is no such block or row.\n */",
|
|
2132
2133
|
"layout": [
|
|
2133
2134
|
{
|
|
2134
2135
|
"param": {
|
|
@@ -2265,20 +2266,20 @@
|
|
|
2265
2266
|
],
|
|
2266
2267
|
"contract": {
|
|
2267
2268
|
"file": "universal_config.inc",
|
|
2268
|
-
"text": "#if defined _universal_config_included\n #endinput\n#endif\n#define _universal_config_included\n\n/**\n * Universal Config System — public API include\n * Version: 1.6.1\n * Author: kukson777\n *\n * A flexible configuration system for parsing, managing and writing INI-like\n * files with support for nested sections, key-value pairs and block structures.\n */\n\n/**\n * Configuration file handle.\n */\nenum ConfigFile {\n CFG_FILE_INVALID = -1\n}\n\n/**\n * Configuration section handle.\n */\nenum ConfigSection {\n CFG_SECTION_INVALID = -1\n}\n\n/**\n * Entry structure type used inside a config section.\n */\nenum EntryType {\n CFG_ENTRY_SIMPLE, // Simple key = value entry\n CFG_ENTRY_BRACKET // Block entry: key { ... }\n}\n\n/**\n * Content type of an entry's value.\n */\nenum ContentType {\n CFG_CONTENT_SIMPLE = 0, // Single value\n CFG_CONTENT_STRINGS, // Array of strings\n CFG_CONTENT_ENTRIES // Array of nested entries\n}\n\n// ============================================================\n// Loading and section lookup\n// ============================================================\n\n/**\n * Loads a configuration file.\n *\n * @param fileName File name (e.g. \"menu.ini\"). If no extension is given,\n * \".ini\" is appended automatically.\n * @return A ConfigFile handle on success, CFG_FILE_INVALID on failure.\n */\nnative ConfigFile:cfg_load_file(const fileName[]);\n\n/**\n * Retrieves a section handle by name from a loaded configuration.\n *\n * @param cfg ConfigFile handle returned by cfg_load_file.\n * @param sectionName Name of the section to look up.\n * @return A ConfigSection handle on success,\n * CFG_SECTION_INVALID if not found.\n */\nnative ConfigSection:cfg_get_section(ConfigFile:cfg, const sectionName[]);\n\n// ============================================================\n// Reading values\n// ============================================================\n\n/**\n * Retrieves a string value from a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path (e.g. \"key\" or \"block/subkey\").\n * @param value Output buffer (recommended size: 512).\n * @param len Maximum buffer length.\n * @param index Value index for multi-value keys (default: 0).\n * @return true if the value was found and written, false otherwise.\n */\nnative bool:cfg_get_value(ConfigSection:section, const key[], value[], len, index = 0);\n\n/**\n * Retrieves a string value by its hierarchical path.\n *\n * @param section ConfigSection handle.\n * @param path Path to the value (e.g. \"MAIN/HUD\").\n * @param value Output buffer.\n * @param len Maximum buffer length.\n * @param index Value index (default: 0).\n * @param lineIndex Line index within a block (default: 0).\n * @return true if the value was found, false otherwise.\n */\nnative bool:cfg_get_value_by_path(ConfigSection:section, const path[], value[], len, index = 0, lineIndex = 0);\n\n/**\n * Retrieves an integer value from a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @param index Value index (default: 0).\n * @return Integer value, or 0 if not found.\n */\nnative cfg_get_int(ConfigSection:section, const key[], index = 0);\n\n/**\n * Retrieves a float value from a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @param index Value index (default: 0).\n * @return Float value, or 0.0 if not found.\n */\nnative Float:cfg_get_float(ConfigSection:section, const key[], index = 0);\n\n/**\n * Retrieves a boolean value from a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @param index Value index (default: 0).\n * @return true if the value is non-zero, false if not found or zero.\n */\nnative bool:cfg_get_bool(ConfigSection:section, const key[], index = 0);\n\n/**\n * Returns a dynamic array of string tokens split from a single config line\n * (space-delimited, quote-aware).\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @param index Line index for multi-value keys (default: 0).\n * @return Array handle with string tokens, or Invalid_Array on failure.\n * The caller is responsible for destroying the array.\n */\nnative Array:cfg_get_value_array(ConfigSection:section, const key[], index = 0);\n\n/**\n * Returns a dynamic array of float values parsed from a single config line.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @param index Line index for multi-value keys (default: 0).\n * @return Array handle with Float values, or Invalid_Array on failure.\n * The caller is responsible for destroying the array.\n */\nnative Array:cfg_get_float_array(ConfigSection:section, const key[], index = 0);\n\n/**\n * Returns a dynamic array of tokens split from a value found by hierarchical path.\n *\n * @param section ConfigSection handle.\n * @param path Path to the block (e.g. \"MAIN/HUD\").\n * @param index Part index within the value (default: 0).\n * @param lineIndex Line index within a block (default: 0).\n * @return Array handle with string tokens, or Invalid_Array on failure.\n */\nnative Array:cfg_get_value_array_by_path(ConfigSection:section, const path[], index = 0, lineIndex = 0);\n\n/**\n * Returns a dynamic array containing all top-level key names in a section.\n *\n * @param section ConfigSection handle.\n * @return Array handle with key strings, or Invalid_Array if empty.\n */\nnative Array:cfg_get_top_level_keys(ConfigSection:section);\n\n/**\n * Returns the raw section data as an array.\n * The array contains three sub-arrays: keys, values and pair-index mappings.\n *\n * @param section ConfigSection handle.\n * @return Array handle, or Invalid_Array if the section is empty.\n */\nnative Array:cfg_get_section_data(ConfigSection:section);\n\n/**\n * Returns the number of values associated with a key.\n *\n * @param section ConfigSection handle.\n * @param key Key name or path.\n * @return Value count, or 0 if the key is not found.\n */\nnative cfg_get_array_size(ConfigSection:section, const key[]);\n\n// ============================================================\n// Writing values\n// ============================================================\n\n/**\n * Sets a string value for a key.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param value String value to set.\n * @param index Value index (default: 0).\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_value(ConfigSection:section, const key[], const value[], index = 0, lineIndex = 0);\n\n/**\n * Sets an integer value for a key.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param value Integer value.\n * @param index Value index (default: 0).\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_int(ConfigSection:section, const key[], value, index = 0);\n\n/**\n * Sets a float value for a key.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param value Float value.\n * @param index Value index (default: 0).\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_float(ConfigSection:section, const key[], Float:value, index = 0);\n\n/**\n * Sets a boolean value for a key.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param value Boolean value.\n * @param index Value index (default: 0).\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_bool(ConfigSection:section, const key[], bool:value, index = 0);\n\n// ============================================================\n// Key and section management\n// ============================================================\n\n/**\n * Deletes a key from a section.\n *\n * @param section ConfigSection handle.\n * @param key Key to delete.\n * @return true if deleted, false if not found or section is invalid.\n */\nnative bool:cfg_delete_key(ConfigSection:section, const key[]);\n\n/**\n * Checks whether a key exists in a section.\n *\n * @param section ConfigSection handle.\n * @param key Key to check.\n * @return true if the key exists, false otherwise.\n */\nnative bool:cfg_has_key(ConfigSection:section, const key[]);\n\n/**\n * Creates a new in-memory section (not backed by a file).\n *\n * @param sectionName Name of the new section.\n * @return ConfigSection handle on success, CFG_SECTION_INVALID on failure.\n */\nnative ConfigSection:cfg_create_section(ConfigFile:cfg, const sectionName[]);\n\n/**\n * Sets the EntryType for a key in a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param entryType CFG_ENTRY_SIMPLE or CFG_ENTRY_BRACKET.\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_entry_type(ConfigSection:section, const key[], EntryType:entryType);\n\n/**\n * Sets the ContentType for a key in a section.\n *\n * @param section ConfigSection handle.\n * @param key Key name.\n * @param contentType CFG_CONTENT_SIMPLE, CFG_CONTENT_STRINGS or CFG_CONTENT_ENTRIES.\n * @return true on success, false otherwise.\n */\nnative bool:cfg_set_entry_content_type(ConfigSection:section, const key[], ContentType:contentType);\n\n// ============================================================\n// Saving and writing\n// ============================================================\n\n/**\n * Writes a section to a file.\n * Can be called with 2 arguments (fileName, sectionName) or with 3 arguments\n * (ConfigFile:cfg, fileName, sectionName) when you need to target a specific\n * loaded file handle.\n *\n * @param fileName Destination file name (e.g. \"core.ini\").\n * @param sectionName Section name to write.\n * @return true on success, false otherwise.\n */\nnative bool:cfg_write_file(ConfigFile:cfg, const fileName[], const sectionName[]);\n\n/**\n * Saves a loaded configuration back to its source file.\n *\n * ';' comment lines are round-tripped: a comment block is re-emitted before the\n * element it preceded in the source (section / top-level key / bracket row).\n * Only comments that were present in the loaded file survive — elements created\n * programmatically (e.g. via cfg_set_value) carry no comment unless one already\n * existed on that row. Pass fileName explicitly for multi-section files.\n *\n * @param cfg ConfigFile handle returned by cfg_load_file.\n * @return true on success, false otherwise.\n */\nnative bool:cfg_save_config(ConfigFile:cfg, const fileName[] = \"\");\n\n// ============================================================\n// Utility\n// ============================================================\n\n/**\n * Sets the base directory used when resolving relative config file names.\n *\n * @param dir Path to the directory (e.g. \"addons/amxmodx/configs/jbe\").\n */\nnative cfg_set_base_dir(const dir[]);\n\n/**\n * Returns the total number of sections currently loaded in memory.\n *\n * @return Section count.\n */\nnative cfg_get_sections_count();\n\n/**\n * Returns the name of a loaded section by its sequential index.\n *\n * @param index Zero-based section index (0 .. cfg_get_sections_count() - 1).\n * @param name Output buffer for the section name.\n * @param len Maximum buffer length.\n * @return 1 on success, 0 if the index is out of range.\n */\nnative cfg_get_section_name(index, name[], len);\n\n/**\n * Sets the leading \"; ...\" comment of a bracket-block row (e.g. the column hint\n * shown above the first data row). Mirrors what a file round-trip preserves, so\n * blocks created programmatically can carry the same in-block hint.\n *\n * @param section Section handle (cfg_get_section / cfg_create_section).\n * @param key Top-level bracket key holding the rows (e.g. \"3x3\", \"CVARS\").\n * @param row Zero-based row index inside the block.\n * @param comment Single comment line incl. leading ';'; \"\" clears it.\n * @return true on success, false if the row/key was not found.\n */\nnative bool:cfg_set_row_comment(ConfigSection:section, const key[], row, const comment[]);\n"
|
|
2269
|
+
"text": "#if defined _universal_config_included\r\n #endinput\r\n#endif\r\n#define _universal_config_included\r\n\r\n/**\r\n * Universal Config System — public API include\r\n * Version: 1.6.1\r\n * Author: kukson777\r\n *\r\n * A flexible configuration system for parsing, managing and writing INI-like\r\n * files with support for nested sections, key-value pairs and block structures.\r\n */\r\n\r\n/**\r\n * Configuration file handle.\r\n */\r\nenum ConfigFile {\r\n CFG_FILE_INVALID = -1\r\n}\r\n\r\n/**\r\n * Configuration section handle.\r\n */\r\nenum ConfigSection {\r\n CFG_SECTION_INVALID = -1\r\n}\r\n\r\n/**\r\n * Entry structure type used inside a config section.\r\n */\r\nenum EntryType {\r\n CFG_ENTRY_SIMPLE, // Simple key = value entry\r\n CFG_ENTRY_BRACKET // Block entry: key { ... }\r\n}\r\n\r\n/**\r\n * Content type of an entry's value.\r\n */\r\nenum ContentType {\r\n CFG_CONTENT_SIMPLE = 0, // Single value\r\n CFG_CONTENT_STRINGS, // Array of strings\r\n CFG_CONTENT_ENTRIES // Array of nested entries\r\n}\r\n\r\n// ============================================================\r\n// Loading and section lookup\r\n// ============================================================\r\n\r\n/**\r\n * Loads a configuration file.\r\n *\r\n * @param fileName File name (e.g. \"menu.ini\"). If no extension is given,\r\n * \".ini\" is appended automatically.\r\n * @return A ConfigFile handle on success, CFG_FILE_INVALID on failure.\r\n */\r\nnative ConfigFile:cfg_load_file(const fileName[]);\r\n\r\n/**\r\n * Retrieves a section handle by name from a loaded configuration.\r\n *\r\n * @param cfg ConfigFile handle returned by cfg_load_file.\r\n * @param sectionName Name of the section to look up.\r\n * @return A ConfigSection handle on success,\r\n * CFG_SECTION_INVALID if not found.\r\n */\r\nnative ConfigSection:cfg_get_section(ConfigFile:cfg, const sectionName[]);\r\n\r\n// ============================================================\r\n// Reading values\r\n// ============================================================\r\n\r\n/**\r\n * Retrieves a string value from a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path (e.g. \"key\" or \"block/subkey\").\r\n * @param value Output buffer (recommended size: 512).\r\n * @param len Maximum buffer length.\r\n * @param index Value index for multi-value keys (default: 0).\r\n * @return true if the value was found and written, false otherwise.\r\n */\r\nnative bool:cfg_get_value(ConfigSection:section, const key[], value[], len, index = 0);\r\n\r\n/**\r\n * Retrieves a string value by its hierarchical path.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param path Path to the value (e.g. \"MAIN/HUD\").\r\n * @param value Output buffer.\r\n * @param len Maximum buffer length.\r\n * @param index Value index (default: 0).\r\n * @param lineIndex Line index within a block (default: 0).\r\n * @return true if the value was found, false otherwise.\r\n */\r\nnative bool:cfg_get_value_by_path(ConfigSection:section, const path[], value[], len, index = 0, lineIndex = 0);\r\n\r\n/**\r\n * Retrieves an integer value from a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @param index Value index (default: 0).\r\n * @return Integer value, or 0 if not found.\r\n */\r\nnative cfg_get_int(ConfigSection:section, const key[], index = 0);\r\n\r\n/**\r\n * Retrieves a float value from a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @param index Value index (default: 0).\r\n * @return Float value, or 0.0 if not found.\r\n */\r\nnative Float:cfg_get_float(ConfigSection:section, const key[], index = 0);\r\n\r\n/**\r\n * Retrieves a boolean value from a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @param index Value index (default: 0).\r\n * @return true if the value is non-zero, false if not found or zero.\r\n */\r\nnative bool:cfg_get_bool(ConfigSection:section, const key[], index = 0);\r\n\r\n/**\r\n * Returns a dynamic array of string tokens split from a single config line\r\n * (space-delimited, quote-aware).\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @param index Line index for multi-value keys (default: 0).\r\n * @return Array handle with string tokens, or Invalid_Array on failure.\r\n * The caller is responsible for destroying the array.\r\n */\r\nnative Array:cfg_get_value_array(ConfigSection:section, const key[], index = 0);\r\n\r\n/**\r\n * Returns a dynamic array of float values parsed from a single config line.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @param index Line index for multi-value keys (default: 0).\r\n * @return Array handle with Float values, or Invalid_Array on failure.\r\n * The caller is responsible for destroying the array.\r\n */\r\nnative Array:cfg_get_float_array(ConfigSection:section, const key[], index = 0);\r\n\r\n/**\r\n * Returns a dynamic array of tokens split from a value found by hierarchical path.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param path Path to the block (e.g. \"MAIN/HUD\").\r\n * @param index Part index within the value (default: 0).\r\n * @param lineIndex Line index within a block (default: 0).\r\n * @return Array handle with string tokens, or Invalid_Array on failure.\r\n */\r\nnative Array:cfg_get_value_array_by_path(ConfigSection:section, const path[], index = 0, lineIndex = 0);\r\n\r\n/**\r\n * Returns a dynamic array containing all top-level key names in a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @return Array handle with key strings, or Invalid_Array if empty.\r\n */\r\nnative Array:cfg_get_top_level_keys(ConfigSection:section);\r\n\r\n/**\r\n * Returns the raw section data as an array.\r\n * The array contains three sub-arrays: keys, values and pair-index mappings.\r\n *\r\n * @param section ConfigSection handle.\r\n * @return Array handle, or Invalid_Array if the section is empty.\r\n */\r\nnative Array:cfg_get_section_data(ConfigSection:section);\r\n\r\n/**\r\n * Returns the number of values associated with a key.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name or path.\r\n * @return Value count, or 0 if the key is not found.\r\n */\r\nnative cfg_get_array_size(ConfigSection:section, const key[]);\r\n\r\n// ============================================================\r\n// Writing values\r\n// ============================================================\r\n\r\n/**\r\n * Sets a string value for a key.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param value String value to set.\r\n * @param index Value index (default: 0).\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_value(ConfigSection:section, const key[], const value[], index = 0, lineIndex = 0);\r\n\r\n/**\r\n * Sets an integer value for a key.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param value Integer value.\r\n * @param index Value index (default: 0).\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_int(ConfigSection:section, const key[], value, index = 0);\r\n\r\n/**\r\n * Sets a float value for a key.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param value Float value.\r\n * @param index Value index (default: 0).\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_float(ConfigSection:section, const key[], Float:value, index = 0);\r\n\r\n/**\r\n * Sets a boolean value for a key.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param value Boolean value.\r\n * @param index Value index (default: 0).\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_bool(ConfigSection:section, const key[], bool:value, index = 0);\r\n\r\n// ============================================================\r\n// Key and section management\r\n// ============================================================\r\n\r\n/**\r\n * Deletes a key from a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key to delete.\r\n * @return true if deleted, false if not found or section is invalid.\r\n */\r\nnative bool:cfg_delete_key(ConfigSection:section, const key[]);\r\n\r\n/**\r\n * Checks whether a key exists in a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key to check.\r\n * @return true if the key exists, false otherwise.\r\n */\r\nnative bool:cfg_has_key(ConfigSection:section, const key[]);\r\n\r\n/**\r\n * Creates a new in-memory section (not backed by a file).\r\n *\r\n * @param sectionName Name of the new section.\r\n * @return ConfigSection handle on success, CFG_SECTION_INVALID on failure.\r\n */\r\nnative ConfigSection:cfg_create_section(ConfigFile:cfg, const sectionName[]);\r\n\r\n/**\r\n * Sets the EntryType for a key in a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param entryType CFG_ENTRY_SIMPLE or CFG_ENTRY_BRACKET.\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_entry_type(ConfigSection:section, const key[], EntryType:entryType);\r\n\r\n/**\r\n * Sets the ContentType for a key in a section.\r\n *\r\n * @param section ConfigSection handle.\r\n * @param key Key name.\r\n * @param contentType CFG_CONTENT_SIMPLE, CFG_CONTENT_STRINGS or CFG_CONTENT_ENTRIES.\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_set_entry_content_type(ConfigSection:section, const key[], ContentType:contentType);\r\n\r\n// ============================================================\r\n// Saving and writing\r\n// ============================================================\r\n\r\n/**\r\n * Writes a section to a file.\r\n * Can be called with 2 arguments (fileName, sectionName) or with 3 arguments\r\n * (ConfigFile:cfg, fileName, sectionName) when you need to target a specific\r\n * loaded file handle.\r\n *\r\n * @param fileName Destination file name (e.g. \"core.ini\").\r\n * @param sectionName Section name to write.\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_write_file(ConfigFile:cfg, const fileName[], const sectionName[]);\r\n\r\n/**\r\n * Saves a loaded configuration back to its source file.\r\n *\r\n * ';' comment lines are round-tripped: a comment block is re-emitted before the\r\n * element it preceded in the source (section / top-level key / bracket row).\r\n * Only comments that were present in the loaded file survive — elements created\r\n * programmatically (e.g. via cfg_set_value) carry no comment unless one already\r\n * existed on that row. Pass fileName explicitly for multi-section files.\r\n *\r\n * @param cfg ConfigFile handle returned by cfg_load_file.\r\n * @return true on success, false otherwise.\r\n */\r\nnative bool:cfg_save_config(ConfigFile:cfg, const fileName[] = \"\");\r\n\r\n// ============================================================\r\n// Utility\r\n// ============================================================\r\n\r\n/**\r\n * Sets the base directory used when resolving relative config file names.\r\n *\r\n * @param dir Path to the directory (e.g. \"addons/amxmodx/configs/jbe\").\r\n */\r\nnative cfg_set_base_dir(const dir[]);\r\n\r\n/**\r\n * Returns the total number of sections currently loaded in memory.\r\n *\r\n * @return Section count.\r\n */\r\nnative cfg_get_sections_count();\r\n\r\n/**\r\n * Returns the name of a loaded section by its sequential index.\r\n *\r\n * @param index Zero-based section index (0 .. cfg_get_sections_count() - 1).\r\n * @param name Output buffer for the section name.\r\n * @param len Maximum buffer length.\r\n * @return 1 on success, 0 if the index is out of range.\r\n */\r\nnative cfg_get_section_name(index, name[], len);\r\n\r\n/**\r\n * Sets the leading \"; ...\" comment of a bracket-block row (e.g. the column hint\r\n * shown above the first data row). Mirrors what a file round-trip preserves, so\r\n * blocks created programmatically can carry the same in-block hint.\r\n *\r\n * @param section Section handle (cfg_get_section / cfg_create_section).\r\n * @param key Top-level bracket key holding the rows (e.g. \"3x3\", \"CVARS\").\r\n * @param row Zero-based row index inside the block.\r\n * @param comment Single comment line incl. leading ';'; \"\" clears it.\r\n * @return true on success, false if the row/key was not found.\r\n */\r\nnative bool:cfg_set_row_comment(ConfigSection:section, const key[], row, const comment[]);\r\n"
|
|
2269
2270
|
},
|
|
2270
2271
|
"author": "kukson777"
|
|
2271
2272
|
},
|
|
2272
2273
|
"systems": {
|
|
2273
2274
|
"windows": {
|
|
2274
2275
|
"file": "prebuilt/windows/config-core.aot",
|
|
2275
|
-
"size":
|
|
2276
|
-
"sha256": "
|
|
2276
|
+
"size": 893128,
|
|
2277
|
+
"sha256": "3cb7d2b06e646214755cbdcfcb87af648758d5023a861d5dc7a9bb58f46d715d"
|
|
2277
2278
|
},
|
|
2278
2279
|
"linux": {
|
|
2279
2280
|
"file": "prebuilt/linux/config-core.aot",
|
|
2280
|
-
"size":
|
|
2281
|
-
"sha256": "
|
|
2281
|
+
"size": 902468,
|
|
2282
|
+
"sha256": "3b9b69f6637754483649aa7bd24282aff44aa1386e7efc57145f4ea92fcc70e8"
|
|
2282
2283
|
}
|
|
2283
2284
|
},
|
|
2284
2285
|
"surface": {
|
|
Binary file
|