Multivalue options

I'd like to have a possibility to specify several values in command line options, e.g.

premake4 --myoption=value1,value2

where 'value1' and 'value2' would be verified with 'allowed' table, and _OPTIONS["myoption"] would contain { "value1", "value2" }

Is this feature difficult to implement?

Difficult's a relative term. :p You can take a look at src/base/options.lua and the command line processing in src/host/premake.c.

Not sure if it's better to do everything on Lua side (pass one string, than explode it and owerwrite _OPTION), or parse list in C. The latter should be better, but I'm not sure how to push table into Lua as an option value and how do those "-1", "-2", "-3" indexes work.

Probably we should do all command line parsing on one side, either C (with good command line library), or Lua.