Skip to content

Crash when reading numbers and/or boolean values from ini files #64

@deining

Description

@deining

Even with #63 applied, reading from .ini files can fail:

Minimum working example:

test.ini

[database]
verbose=true
port=5432

test.lua

1 cli = require 'cliargs';
2 tbl = cli:read_defaults('test.ini', 'ini', 'database', false);

Running test.lua result in this error:

attempt to index a boolean value (local 'str')
stack traceback:
	./cliargs/utils/trim.lua:3: in function 'cliargs.utils.trim'
	./cliargs/config_loader.lua:99: in function 'cliargs.config_loader.from_ini'
	(...tail calls...)
	./test.lua:2: in main chunk
	[C]: in ?

Notes:

  • the error does not occur once I read only string values from the ini file
  • the error disappear once I set the fourth parameter of function read_defaults to true (line 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions