[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_getglobal function argument
- From: Duncan Cross <duncan.cross@...>
- Date: Wed, 8 Feb 2012 11:35:23 +0000
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