[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_getglobal function argument
- From: saito yutaka <melody.pea@...>
- Date: Wed, 8 Feb 2012 23:12:22 +0900
Thanks for your help.
2012/2/8 Duncan Cross <email@example.com>:
> On Wed, Feb 8, 2012 at 10:35 AM, saito yutaka <firstname.lastname@example.org> wrote:
>> Hello .
>> I am trying to read lua.c to want know how lua works.
>> And I want to ask about lua_getglobal function.
>> I find a this code .
>> lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
>> I know that this code means get a value PROMPT("> ") or PROMPT2(">> ") .
>> But why does it use underscore [ _ ] front of global names ?
> Starting with one underscore is just a convention to indicate
> "internal" global variables that relate to the host
> application/current context, rather than the specific program being
> run. For example _VERSION. It is recommended that a piece of pure
> Lua code should avoid using this convention when defining its own
> global variables.
>  http://www.lua.org/manual/5.1/manual.html#pdf-_VERSION