Josef-Friedrich / luakeys

LuaTeX package to parse key value options in Lua only, like keyval, kvsetkeys, kvoptions, xkeyval, pgfkeys but in Lua

Home Page:https://www.ctan.org/pkg/luakeys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change default options for luakeys

kalekje opened this issue · comments

The way I understand the code, default_options is local so it could not be changed outside of the module to adjust the default options after loading the module. I'm curious if this value could become a module variable so one could change the options globally. Example:

luakeys.default_options.naked_as_value = true
luakeys.parse('a,b,c') -> {'a','b','c'}    <- I wouldn't have to enter in opts each time if I set above

This feature is already implemented: Use luakeys.opts

    local defaults = luakeys.opts
    local old = defaults.convert_dimensions
    defaults.convert_dimensions = true
    assert.are.same({ 1234567 },
      luakeys.parse('1cm', { naked_as_value = true }))
    defaults.convert_dimensions = false
    assert.are.same({ '1cm' },
      luakeys.parse('1cm', { naked_as_value = true }))