lua-users home
lua-l archive

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


2017-09-06 20:03 GMT+02:00 Martin <eden_martin_fuhrspam@gmx.de>:
> On 09/06/2017 12:32 PM, Dirk Laurie wrote:
>> 2017-09-06 10:26 GMT+02:00 Daurnimator <quae@daurnimator.com>:
>>> 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.
>>
>> local path = {}
>> package.path:gsub("[^;]*,function(x) path[#path+1]=x end
>>
>> A breaking change to save having to code that? DMML
>>
>
> String format for <package.path> looks like fossil from early versions.

You should not lightly make remarks like that. Lua does deliver "arg"
as a table, so the designers do take that possibility into account.

The reason for the string is that operating systems do it that way.
One gsub, and your package.path turns into the $PATH that the
operating system requires. It is the obvious and easy way to provide
the interface.

> To get terms (for example, when searching module "by hands") we have to
> implement our own parsing functions.

As I have demonstrated, if you want a table, it takes two lines to get it.