Talk:Lua (programming language): Difference between revisions
MiszaBot I (talk | contribs) m Archiving 1 thread(s) (older than 30d) to Talk:Lua (programming language)/Archive 1. |
Make archives visible again. |
||
(112 intermediate revisions by 56 users not shown) | |||
Line 1: | Line 1: | ||
{{Talk header}} |
|||
{{talkheader|search=yes}} |
|||
{{WikiProject |
{{WikiProject banner shell|collapsed=yes|class=C|vital=yes|1= |
||
{{ |
{{WikiProject Brazil|edu=yes|importance=low}} |
||
{{WikiProject Computer science|importance=mid}} |
|||
{{auto archiving notice|bot=MiszaBot|age=30|dounreplied=yes}} |
|||
{{WikiProject Computing |importance=mid |free-software=yes |free-software-importance=Mid |software=yes }} |
|||
}} |
|||
{{User:HBC Archive Indexerbot/OptIn |
{{User:HBC Archive Indexerbot/OptIn |
||
|target=Talk:Lua (programming language)/Archive index |
|target=Talk:Lua (programming language)/Archive index |
||
Line 9: | Line 11: | ||
|indexhere=yes}} |
|indexhere=yes}} |
||
{{User:MiszaBot/config |
{{User:MiszaBot/config |
||
|archiveheader = {{aan |
|archiveheader = {{aan}} |
||
|maxarchivesize = |
|maxarchivesize = 31K |
||
|counter = |
|counter = 2 |
||
|minthreadsleft = |
|minthreadsleft = 4 |
||
|minthreadstoarchive = 1 |
|minthreadstoarchive = 1 |
||
|algo = old( |
|algo = old(365d) |
||
|archive = Talk:Lua (programming language)/Archive %(counter)d |
|archive = Talk:Lua (programming language)/Archive %(counter)d |
||
}} |
}} |
||
== Can embedding [[Lisp_(programming_language)|Lisp]]<nowiki />-like code? == |
|||
== Baldur's Gate == |
|||
I am pretty sure Lua was only present in the original Baldur's Gate engine. Even then it wasn't used as a part of the actual game or content. It was only used afaik as a debugging aid during development and as a cheat/debugging console. [http://www.ugcs.caltech.edu/~jedwin/baldur.html Here] and [http://www.lua.org/uses.html#24 here] are sources to verify the info. |
|||
== Criticism of Lua == |
|||
The main page should include a 'criticism of Lua' section. |
|||
[[User:Ratecrash|Ratecrash]] ([[User talk:Ratecrash|talk]]) 17:02, 18 January 2009 (UTC) |
|||
: No, it shouldn't. See [[WP:CSECTION]]. [[user:thumperward|Chris Cunningham (not at work)]] - [[user talk:thumperward|talk]] 16:10, 30 January 2009 (UTC) |
|||
::[[WP:CSECTION]] says that it is ''"a proposed Wikipedia policy, guideline, or process. The proposal may still be in development, under discussion, or in the process of gathering consensus for adoption. Thus references or links to this page should not describe it as "policy""'', and it gives both pros and cons for including a criticism section. -- [[Special:Contributions/201.37.230.43|201.37.230.43]] ([[User talk:201.37.230.43|talk]]) 03:30, 20 April 2009 (UTC) |
|||
== Assessment == |
|||
I've given it a B from a C. It certainly is written well. <font face="Papyrus">'''<font color=#9966CC>-</font>[[User:Download|<font color=#7B68EE>down</font>]][[User talk:Download|<font color=#9966CC>load</font>]] <font color=#7B68EE><nowiki>|</nowiki></font> [[User:Download/Guestbook|<font color=#8A2BE2>sign!</font>]]'''</font> 22:07, 7 April 2009 (UTC) |
|||
== First register-based VM in wide use? == |
|||
Erlang has a register-based VM, and while I have no idea which of lua and erlang are in wider use. Erlang is certainly in wide use and some 5 years older than lua. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/130.243.171.93|130.243.171.93]] ([[User talk:130.243.171.93|talk]]) 21:01, 3 May 2009 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--> |
|||
:According to TIOBE [http://www.tiobe.com/content/paperinfo/tpci/index.html], Erlang is still not so widely cited on the Web as Lua. Wikipedia currently renders only 6 articles of Erlang-based software ([[:Category:Erlang programming language]]). Should there be more? --[[User:4th-otaku|4th-otaku]] ([[User talk:4th-otaku|talk]]) 01:56, 18 May 2009 (UTC) |
|||
e.g.: |
|||
== Memory footprint and execution speed == |
|||
<pre> |
|||
quote(string) -> "string" |
|||
quote(quote(expr)) -> "quote(expr)" |
|||
quote(quasiquote(expr)) -> "quasiquote(expr)" |
|||
quote(quasiquote(unquote(expr))) -> "quasiquote(unquote(expr))" |
|||
quote(unquote(expr)) -> "unquote(expr)" |
|||
quasiquote(string) -> "string" |
|||
quasiquote(quote(expr)) -> "quote(expr)" |
|||
quasiquote(quasiquote(expr)) -> "quasiquote(expr)" |
|||
quasiquote(unquote(expr)) -> expr |
|||
</pre> |
|||
== Object oriented programming? == |
|||
I wish this article mentioned Lua's very small memory footprint relative to most scripting languages, and it's relativly fast execution speed. Those are its main draws. [[Special:Contributions/207.62.246.30|207.62.246.30]] ([[User talk:207.62.246.30|talk]]) 23:25, 22 May 2009 (UTC) |
|||
:Yes, agreed, they should be expounded. I'm a LUA newbie and those two reasons are what attracted me over many other 'competitors'. From comparisions I've seen with other dynamic languages (Python, Ruby), it's quite fast. [[Special:Contributions/71.214.223.133|71.214.223.133]] ([[User talk:71.214.223.133|talk]]) 02:19, 28 November 2009 (UTC) |
|||
In 'metatables', we learn that __index is a function that is called __index(self, key) whenever a key is not found. |
|||
== List of applications == |
|||
But in 'object oriented programming', __index is set to Vector itself. |
|||
I suggest moving the list of applications to its own article, much like [[List of Python software]]. [[User:SharkD|SharkD]] ([[User talk:SharkD|talk]]) 07:50, 13 September 2009 (UTC) |
|||
:Seems like it's not make much sense to spawn another instance of [http://lua-users.org/wiki/LuaAddons LuaAddons] here. This kind of lists is better when they are [[Singleton pattern|single]]. The contrary leads to discrepancies and problems for users (doubling the work for look up or add an entry). |
|||
:The sole excuse to keep up the list is to support the statement that Lua is a popular language. If this ever become more or less undisputable (as it is in the game industry) we would just drop it. |
|||
:Nevertheless, feel free to move it to a [[List of Lua software]] at anytime. --[[User:4th-otaku|4th-otaku]] ([[User talk:4th-otaku|talk]]) 15:45, 22 April 2010 (UTC) |
|||
Does this mean that a table *is* a self function that performs lookup? That x['foo'] is the same as x(x, 'foo') ? |
|||
== Stuff removed from Boolean data type article == |
|||
[[Special:Contributions/203.13.3.90|203.13.3.90]] ([[User talk:203.13.3.90|talk]]) 00:54, 21 July 2020 (UTC) |
|||
The following section was removed from the article [[Boolean data type]]:<br/>'''begin removed text''' |
|||
: |
|||
---- |
|||
: No it isn't. You can convince yourself of that by using https://www.lua.org/cgi-bin/demo and pasting the following: |
|||
---- |
|||
: <syntaxhighlight lang="lua"> |
|||
[[Lua (programming language)|Lua]] defines a <code>boolean</code> type which can be either <code>true</code> or <code>false</code> as of version 5.0.<ref>{{cite web|title=Lua Manual 5.1|url=http://www.lua.org/manual/5.1/manual.html#2.2}}</ref> In addition to the value <code>false</code>, the special value <code>nil</code> (of type <code>nil</code>) also evaluates to false in logical expressions. In versions prior to 5.0, only the value <code>nil</code> evaluated to false (and conditional expressions which were false resulted in the value <code>nil</code> being returned).<ref>{{cite web|title=The Evolution of an Extension Language: A History of Lua|url=http://www.lua.org/history.html}}</ref> The usefulness of the values <code>true</code> and <code>false</code> are limited in certain situations because the logical operators <code>and</code> and <code>or</code> return one of their arguments as the result instead of the value <code>true</code> or <code>false</code>. This construct allows logical operations in Lua to act similar to C's [[Ternary operation|Ternary Operator]], [[?:]] |
|||
x = {} |
|||
x['foo'] = 123 |
|||
<source lang="Lua"> |
|||
local a, b = 1, 2; |
|||
print( x['foo'] ) |
|||
local function isTrue(condition, message) |
|||
print((message or "<nothing> (which becomes 'nil')") .. " is " .. (condition and "TRUE" or "FALSE")) |
|||
end |
|||
print( x(x, 'foo') ) |
|||
-- All of the below display "TRUE" |
|||
</syntaxhighlight> |
|||
isTrue(true, "true") |
|||
: The first print returns 123 as expected, the second returns an error. A table clearly performs a lookup, but is not a function in the Lua sense. For more information on datatypes, see https://www.lua.org/manual/5.3/manual.html#2 --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 19:57, 21 July 2020 (UTC) |
|||
isTrue(0, "0") |
|||
isTrue(1, "1") |
|||
isTrue("Foo", "Foo") |
|||
isTrue(a == a, "a == a") |
|||
== Not strongly typed == |
|||
-- All of the below display "FALSE" |
|||
isTrue(false, "false") |
|||
isTrue(nil, "nil") |
|||
isTrue() |
|||
isTrue(a == b, "a == b") |
|||
isTrue(c, "c") |
|||
isTrue(a == c, "a == c") |
|||
</source> |
|||
---- |
|||
---- |
|||
'''end removed text'''<br/>Is there a place for this text in the Lua-related articles? Perhaps in the Wikibook? Thanks, and all the best, --[[User:Jorge Stolfi|Jorge Stolfi]] ([[User talk:Jorge Stolfi|talk]]) 23:43, 30 December 2009 (UTC) |
|||
Info box says in "Typing discipline", "strong", but that is not true. |
|||
== Archiving == |
|||
Similar to PHP or JavaScript, (and probably Perl and AWK), Lua has is weakly typed especially in arithmetic, i.e. "10" + 1 is allowed and result is integer 11 (technically number 11.0). Same with "5.5" * "2", is integer 11. On the other hand indexing into a "array" (table), t["1"] and t[1] are different (but t[0+"1"] and t[1] are same). |
|||
Does anyone object to me setting up automatic archiving for this page using MiszaBot? Unless otherwise agreed, I would set it to archive threads that have been inactive for 30 days.--[[User:Oneiros|Oneiros]] ([[User talk:Oneiros|talk]]) 13:48, 9 January 2010 (UTC) |
|||
:{{done}}--[[User:Oneiros|Oneiros]] ([[User talk:Oneiros|talk]]) 21:01, 16 January 2010 (UTC) |
|||
Some people argue that that is still strong typing, because for string concatenation one would use ".." in Lua. But that is not good enough argument. For example Wikipedia says C is weakly typed, but arguably Lua has even weaker type system, due to above mentioned value coercion in arithmetic, which does not happen in C. [[Special:Contributions/81.6.34.169|81.6.34.169]] ([[User talk:81.6.34.169|talk]]) 01:32, 1 September 2024 (UTC) |
|||
== io.write("Hello World!\n") == |
|||
== Problems with "Inheritance" section == |
|||
Is it not [[KISS principle|complicate]] the article? It seems like it does not illustrate any essential feature of the language, just explains the parameter format of two particular functions. --[[User:4th-otaku|4th-otaku]] ([[User talk:4th-otaku|talk]]) 22:32, 2 June 2010 (UTC) |
|||
:I've removed it. --[[User:4th-otaku|4th-otaku]] ([[User talk:4th-otaku|talk]]) 21:39, 12 July 2010 (UTC) |
|||
The "Inheritance" subcategory in the article is written and phrased in a way that could easily lead a reader to believe believe features such as multiple inheritance are features built into the Lua language. However, the technique is a pattern implemented using metatables, not a language feature. |
|||
== Lua is widely used in the video game industry == |
|||
While the "Object-oriented programming" category above does indeed explain that Lua doesn't have a built-in concept of classes, the addition of the class inheritance section below it seems to deviate from that tone, and it describes a niche pattern that is rarely used; it feels like somebody wrote their own little pet program in Lua and added it to the article masquerading as a feature. [[Special:Contributions/24.68.84.200|24.68.84.200]] ([[User talk:24.68.84.200|talk]]) 07:17, 29 September 2024 (UTC) |
|||
"Lua is widely used in the video game industry. " |
|||
please give citation for it. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/203.78.217.151|203.78.217.151]] ([[User talk:203.78.217.151|talk]]) 15:00, 15 July 2010 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--> |
Latest revision as of 08:04, 18 November 2024
This is the talk page for discussing improvements to the Lua (programming language) article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
Archives: Index, 1, 2Auto-archiving period: 12 months |
This level-5 vital article is rated C-class on Wikipedia's content assessment scale. It is of interest to multiple WikiProjects. | |||||||||||||||||||||||||||||||||||||||||||||||
|
e.g.:
quote(string) -> "string" quote(quote(expr)) -> "quote(expr)" quote(quasiquote(expr)) -> "quasiquote(expr)" quote(quasiquote(unquote(expr))) -> "quasiquote(unquote(expr))" quote(unquote(expr)) -> "unquote(expr)" quasiquote(string) -> "string" quasiquote(quote(expr)) -> "quote(expr)" quasiquote(quasiquote(expr)) -> "quasiquote(expr)" quasiquote(unquote(expr)) -> expr
Object oriented programming?
[edit]In 'metatables', we learn that __index is a function that is called __index(self, key) whenever a key is not found.
But in 'object oriented programming', __index is set to Vector itself.
Does this mean that a table *is* a self function that performs lookup? That x['foo'] is the same as x(x, 'foo') ?
203.13.3.90 (talk) 00:54, 21 July 2020 (UTC)
- No it isn't. You can convince yourself of that by using https://www.lua.org/cgi-bin/demo and pasting the following:
x = {} x['foo'] = 123 print( x['foo'] ) print( x(x, 'foo') )
- The first print returns 123 as expected, the second returns an error. A table clearly performs a lookup, but is not a function in the Lua sense. For more information on datatypes, see https://www.lua.org/manual/5.3/manual.html#2 --RexxS (talk) 19:57, 21 July 2020 (UTC)
Not strongly typed
[edit]Info box says in "Typing discipline", "strong", but that is not true.
Similar to PHP or JavaScript, (and probably Perl and AWK), Lua has is weakly typed especially in arithmetic, i.e. "10" + 1 is allowed and result is integer 11 (technically number 11.0). Same with "5.5" * "2", is integer 11. On the other hand indexing into a "array" (table), t["1"] and t[1] are different (but t[0+"1"] and t[1] are same).
Some people argue that that is still strong typing, because for string concatenation one would use ".." in Lua. But that is not good enough argument. For example Wikipedia says C is weakly typed, but arguably Lua has even weaker type system, due to above mentioned value coercion in arithmetic, which does not happen in C. 81.6.34.169 (talk) 01:32, 1 September 2024 (UTC)
Problems with "Inheritance" section
[edit]The "Inheritance" subcategory in the article is written and phrased in a way that could easily lead a reader to believe believe features such as multiple inheritance are features built into the Lua language. However, the technique is a pattern implemented using metatables, not a language feature.
While the "Object-oriented programming" category above does indeed explain that Lua doesn't have a built-in concept of classes, the addition of the class inheritance section below it seems to deviate from that tone, and it describes a niche pattern that is rarely used; it feels like somebody wrote their own little pet program in Lua and added it to the article masquerading as a feature. 24.68.84.200 (talk) 07:17, 29 September 2024 (UTC)
- C-Class level-5 vital articles
- Wikipedia level-5 vital articles in Technology
- C-Class vital articles in Technology
- C-Class Brazil articles
- Low-importance Brazil articles
- C-Class education and science in Brazil articles
- Low-importance education and science in Brazil articles
- Education and science in Brazil task force articles
- WikiProject Brazil articles
- C-Class Computer science articles
- Mid-importance Computer science articles
- WikiProject Computer science articles
- C-Class Computing articles
- Mid-importance Computing articles
- C-Class software articles
- Unknown-importance software articles
- C-Class software articles of Unknown-importance
- All Software articles
- C-Class Free and open-source software articles
- Mid-importance Free and open-source software articles
- C-Class Free and open-source software articles of Mid-importance
- All Free and open-source software articles
- All Computing articles