Talk:Lua Programming/Introduction

Use of 'print' function in example
Re: the "Hello World!" example: The book should take account of the fact that Lua is most extensively used as a language to extend a program written in C or C++ and in such situations users rarely have access to a command line console for use of Lua, hence the print function is not available to them. In such situations, the parent program will almost always provide an API GUI method to display results of a script such as a message box or info box. Users in such situations should check the program's API documentation to identify an API GUI method to display script results. That advice should at minimum be footnoted from the "Hello World!" example. But better I think if it were integrated into the body text. Marbux (discuss • contribs) 01:42, 10 December 2013 (UTC)
 * I should indeed have mentioned this. I have added a note about it in the body of the text, at the bottom of the section. -- Mark Otaris (discuss • contribs) 04:42, 18 December 2013 (UTC)

Syntax Section
In the Syntax section, I suggest removing the entire discussion of Backus–Naur form, which includes in its opening sentence, "but you wouldn't understand anything if you read it." In other words, this portion of the Introduction is aimed at a superfluous topic that can only distract from the Lua programming book's goal, teaching beginners to program with Lua. Likewise, the accompanying discussion of English as a programming metalanguage seems tangential to the book's topic. I suggest that this section instead point to and discuss the [Lexical Conventions section of the Lua Reference Manual. [[User:Marbux|Marbux]] (discuss • contribs) 02:24, 10 December 2013 (UTC)
 * I understand that it isn't directly related to the topic of the book, but I couldn't think of a better way to introduce syntax. This book is meant for beginners to programming as well as for more advanced programmers, so it is necessary to introduce concepts like syntax. If you can think of a better way to introduce it, feel free to rewrite the section. -- Mark Otaris (discuss • contribs) 04:44, 18 December 2013 (UTC)

Discussion of 'long brackets'
The discussion of "long brackets" should be removed and replaced by a discussion of "long comments." "Long brackets" are a defined term in Lua that applies only to strings delimited by brackets and using equal signs to indicate nesting level. The term has almost no relationship to "long comments," another term separately defined by Lua. (When metaprogramming Lua, both "short" and "long comments" can be converted to short or long bracket strings, as is done for documentation of Lua modules using the LuaDoc module. Otherwise long brackets have only a syntatactic similarity to long comments. Their semantics are entirely different. See my lengthier discussion of this issue on the Talk page for the Expressions chapter. Marbux (discuss • contribs) 04:14, 10 December 2013 (UTC)
 * Long brackets apply to comments as well as to strings. Putting equal signs inside these brackets works in the same way for strings as it does for comments; the only difference really is that two hyphens must be added in front of the opening long bracket for comments, while this is not the case for strings. In all other ways, they are identical, and the Lua 5.2 Reference Manual explicitly mentions that comments use long brackets, in the same section as the section where it explains what a long bracket is and where it explains they can be used for strings (I have put in bold all occurrences of "long bracket"):
 * "Literal strings can also be defined using a long format enclosed by long brackets. We define an opening long bracket of level n as an opening square bracket followed by n equal signs followed by another opening square bracket. So, an opening long bracket of level 0 is written as [[, an opening long bracket of level 1 is written as [=[, and so on. A closing long bracket is defined similarly; for instance, a closing long bracket of level 4 is written as ]====]. A long literal starts with an opening long bracket of any level and ends at the first closing long bracket of the same level. It can contain any text except a closing bracket of the proper level. Literals in this bracketed form can run for several lines, do not interpret any escape sequences, and ignore long brackets of any other level. Any kind of end-of-line sequence (carriage return, newline, carriage return followed by newline, or newline followed by carriage return) is converted to a simple newline. ― Section 3.1|undefined"
 * "A comment starts with a double hyphen (--) anywhere outside a string. If the text immediately after -- is not an opening long bracket, the comment is a short comment, which runs until the end of the line. Otherwise, it is a long comment, which runs until the corresponding closing long bracket. Long comments are frequently used to disable code temporarily. ― Also section 3.1, but at the bottom"
 * I also noticed your edits that added hyphens before closing long brackets to close comments, but I have reverted them after testing and verifying in the reference manual. Could you explain what you meant? --Mark Otaris (discuss • contribs) 04:53, 18 December 2013 (UTC)

Is this a typo?
In Lua Programming/Introduction: "Another of the important advantages of Lua is its capacity to be embedded [...]" Should it be capability instead of capacity? --Johnwayne1986 (discuss • contribs) 15:31, 6 August 2015 (UTC)
 * “Capability” is one of the meanings of “capacity”, but “capability” arguably looks better than “capacity” here. I've changed this. --Mark Otaris (discuss • contribs) 07:40, 21 August 2015 (UTC)

Lua means "two" in Hawaiʻian
Etymology trivia: the statement "Lua comes from two languages" is more appropriate than most would realize. Among the multiple meanings that lua has in Hawaiʻian is the number two. (See ) A typical example would be Nā Mokulua, "the two islands". Peaceray (discuss • contribs) 16:48, 19 October 2020 (UTC)