Skip to content

fix(change opts): fix the ability to change opts of current tomlua#80

Merged
BirdeeHub merged 1 commit into
masterfrom
change_opts
May 11, 2026
Merged

fix(change opts): fix the ability to change opts of current tomlua#80
BirdeeHub merged 1 commit into
masterfrom
change_opts

Conversation

@BirdeeHub
Copy link
Copy Markdown
Owner

before the only way to get one with new settings was to copy a new one via the function call local newtomlua = tomlua(newopts) syntax.

This was not intentional, but a consequence of the fact that, if a value was already in a table, __newindex is never called to tell our C representation that something changed.

This means we can no longer mirror the opts into the lua table, the table is now purely a proxy table for the opts. In exchange, we can actually change them.

This means you can now tomlua.opts.some_opt = true at runtime, as was the original intention

To get the table, you can now call tomlua.opts() with no arguments and it will return it to you as a lua table.

before the only way to get one with new settings was to copy a new one
via the function call local newtomlua = tomlua(newopts) syntax.

This was not intentional, but a consequence of the fact that, if a value
was already in a table, __newindex is never called to tell our C
representation that something changed.

This means we can no longer mirror the opts into the lua table, the
table is now purely a proxy table for the opts. In exchange, we can
actually change them.

This means you can now `tomlua.opts.some_opt = true` at runtime, as was
the original intention

To get the table, you can now call tomlua.opts() with no arguments and
it will return it to you as a lua table.
@BirdeeHub BirdeeHub merged commit b5a0296 into master May 11, 2026
3 checks passed
@BirdeeHub BirdeeHub deleted the change_opts branch May 11, 2026 06:59
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.

1 participant