|
90 | 90 | print(f"example.py: cfg['config.paths.tempdir_raw'] = {cfg.get('config.paths.tempdir_raw', 'NOT_FOUND')}") |
91 | 91 | print(f"example.py: cfg['config.paths.workdir_raw'] = {cfg.get('config.paths.workdir_raw', 'NOT_FOUND')}") |
92 | 92 | print(f"example.py: cfg['config.paths.dynpath_raw'] = {cfg.get('config.paths.dynpath_raw', 'NOT_FOUND')}") |
93 | | -print(f"example.py: (should be empty, because it exist, but is a container) cfg['config.sub'] = {cfg.get('config.sub', 'NOT_FOUND')}") |
94 | 93 | print(f"example.py: cfg['config.sub.lua_v1'] = {cfg.get('config.sub.lua_v1', 'NOT_FOUND')}") |
95 | 94 | print(f"example.py: cfg['config.sub.lua_v2'] = {cfg.get('config.sub.lua_v2', 'NOT_FOUND')}") |
96 | 95 | print(f"example.py: cfg['config.sub.lua_v3'] = {cfg.get('config.sub.lua_v3', 'NOT_FOUND')}") |
|
101 | 100 | print(f"example.py: cfg['config.sub.string'] = {cfg.get('config.sub.string', 'NOT_FOUND')}") |
102 | 101 | print(f"example.py: cfg['config.sub.problematic_string'] = {cfg.get('config.sub.problematic_string', 'NOT_FOUND')}") |
103 | 102 | print(f"example.py: cfg['config.sub.non_latin_string'] = {cfg.get('config.sub.non_latin_string', 'NOT_FOUND')}") |
| 103 | +print(f"example.py: (should be empty regardless of fallback value, because it is a container: cfg['config.sub.sub']) = {cfg.get('config.sub.sub', 'NOT_FOUND')}") |
| 104 | +print(f"example.py: cfg['config.sub.sub'] as int with fallback value -1) = {cfg.get_int('config.sub.sub',-1)}") |
| 105 | +print(f"example.py: cfg['config.sub.sub'] as int with fallback value -1.6) = {cfg.get_int('config.sub.sub',-1.6)}") |
| 106 | +print(f"example.py: cfg['config.sub.sub'] as float with fallback value -1.5) = {cfg.get_float('config.sub.sub',-1.5)}") |
104 | 107 | print(f"example.py: cfg['config.sub.sub.message'] = {cfg.get('config.sub.sub.message', 'NOT_FOUND')}") |
105 | 108 | print(f"example.py: cfg['config.sub.sub.message2'] = {cfg.get('config.sub.sub.message2', 'NOT_FOUND')}") |
106 | 109 | print(f"example.py: cfg['config.sub.multiline_string'] = {cfg.get('config.sub.multiline_string', 'NOT_FOUND')}") |
107 | 110 |
|
108 | 111 | # Test mixed table access (indexed and named elements) |
109 | 112 | print(f"example.py: table start for config.sub.mixed: {cfg.get_table_start('config.sub.mixed')}") |
110 | 113 | print(f"example.py: table end for config.sub.mixed: {cfg.get_table_end('config.sub.mixed')}") |
| 114 | +print(f"example.py: table indices sequence for config.sub.mixed: {cfg.get_table_seq('config.sub.mixed')}") |
111 | 115 | print(f"example.py: cfg['config.sub.mixed.1'] = {cfg.get('config.sub.mixed.1', 'NOT_FOUND')}") |
112 | 116 | print(f"example.py: cfg['config.sub.mixed.2'] = {cfg.get('config.sub.mixed.2', 'NOT_FOUND')}") |
113 | 117 | print(f"example.py: cfg['config.sub.mixed.3'] = {cfg.get('config.sub.mixed.3', 'NOT_FOUND')}") |
114 | 118 | print(f"example.py: cfg['config.sub.mixed.4'] = {cfg.get('config.sub.mixed.4', 'NOT_FOUND')}") |
115 | 119 | print(f"example.py: cfg['config.sub.mixed.key'] = {cfg.get('config.sub.mixed.key', 'NOT_FOUND')}") |
116 | 120 |
|
| 121 | +# Show extra cmdline parameters passed to lua script as loader.args table and assigned to config.sub.loader_args |
| 122 | +print(f"example.py: config.sub.loader_args indices sequence: {cfg.get_table_seq('config.sub.loader_args')}") |
| 123 | +for i in cfg.get_table_seq('config.sub.loader_args'): |
| 124 | + print(f"example.py: cfg['config.sub.loader_args.{i}'] = {cfg.get(f'config.sub.loader_args.{i}', 'NOT_FOUND')}") |
0 commit comments