lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2017-09-06 10:26 GMT+02:00 Daurnimator <>:
> At the moment, package.path and package.cpath are strings containing
> semicolon separated lists.
> I'd like to propose that they are transitioned to be sequences to
> allow for easier programmatic manipulation.
> The environment variables LUA_PATH, LUA_PATH_5_4, LUA_CPATH, etc
> wouldn't change: they'd just need to be parsed when the package
> library is loaded.
> In the next release we can allow package.path and package.cpath to be
> strings for compatibility.
> However the construct `package.path = package.path ..
> ";/my/path/?.lua" would break and need to be changed to
> `table.insert(package.path, "/my/path/?.lua")`
> If this breakage is too much, perhaps we could have three phases:
>   - phase 1. we allow table form, but still use string form on lua
> command line application load.
>   - phase 2. we change the default to be table form; string form is deprecated
>   - phase 3. we remove support for string form.

local path = {}
package.path:gsub("[^;]*,function(x) path[#path+1]=x end

A breaking change to save having to code that? DMML