Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#64 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
lua
Domain
cli

Research direction

Start by running the provided test.ini and test.lua example, then inspect cliargs/config_loader.lua around line 99 and cliargs/utils/trim.lua around line 3. Confirm that numeric and boolean INI values no longer crash while string values continue to work, including the read_defaults fourth-parameter cases described in the issue.

Written by the indexing model from the issue text.

Description

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)
Dominant language
Lua
Stars
129
Forks
26
Avg merge
1h 41m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lunarmodules/lua_cliargs

All issues in lunarmodules/lua_cliargs

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.