lua-users home
lua-l archive

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


On Fri, Apr 12, 2013 at 4:57 PM, Aggelos Kolaitis <neoaggelos@gmail.com> wrote:
> I'm relatively new to scripting with Lua, ( I use it mostly for writing
> premake scripts).
>
>
> Anyway, I would like to know how it could be possible to extract parts of a
> string. Since I can't specify exactly what I want, I will tell you with an
> example.
> I handle all the command line arguments given to the script via a global
> _ARGS table. What I want is to handle arguments like --prefix=path.
> (Check if the argument starts with --prefix=, and if so get the path value)
>
> So How can I get the value of path only, which practically means the
> contents of a string after a given index.
>
> Is something like that possible ?
>
> Thanks in advance,
> Aggelos Kolaitis
>

Quite simple.

http://pgl.yoyo.org/luai/i/string.find
http://pgl.yoyo.org/luai/i/string.sub

/s/ Adam