lua-users home
lua-l archive

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


So I took a quick glance at the lua.c (interpreter) source and found out you could do this:

$ lua
Lua 5.3.2  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> _PROMPT="~> "
~> _PROMPT="=> "
=> _PROMPT2="~> "
=> do
~> end
=>

The Lua 5.3 manual says, about names, "As a convention, programs should avoid creating names that start with an underscore followed by one or more uppercase letters (such as _VERSION).", and about the registry, "As with variable names, string keys starting with an underscore followed by uppercase letters are reserved for Lua.", and the Lua interpreter/REPL is a program. Does this mean it's always safe to use the globals _PROMPT and _PROMPT2? Or should the REPL be moved into a preloaded "repl" library instead?

Also why isn't this documented anywhere?

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.