Skip to content

Fix boolean table values in options table passed to luaRunFile - #28

Merged
keenanlang merged 1 commit into
epics-modules:masterfrom
nmarks99:master
Oct 7, 2026
Merged

keenanlang merged 1 commit into
epics-modules:masterfrom
nmarks99:master

Conversation

@nmarks99

@nmarks99 nmarks99 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

luaMacrosFromTable in luaEpics.cpp tries converting each value in the table to a string, regardless of its actual type and this fails for booleans (result will be NULL)

const char* val = lua_tostring(state, -1);

Because of this, passing {async = true} as an options table to luaRunFile fails silently (but {async = 1} works) as described in the docs here:
luaRunFile("tick.lua", nil, {async=true}) -- background thread

This commit fixes this by explicitly checking the type and manually converting boolean true to "true" and false to "false". This allows us to pass {async = true} as the options table for luaRunFile as advertised in the documentation.

Assisted-by: GPT-5.6 Sol

luaMacrosFromTable in luaEpics.cpp tried converting each value
in the table to a string, regardless of its actual type and
this fails for booleans. This commit fixes this by explicity
checking the type and  manually converting boolean true to "true"
and false to "false". This allows us to pass {async = true}
as the options table for luaRunFile as advertised in the
documentation.
@keenanlang
keenanlang merged commit 01aa7a1 into epics-modules:master Oct 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants