Jump to content

Talk:Lua (programming language)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Can embedding Lisp-like code?[edit]

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

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Lua (programming language). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 20:32, 7 January 2018 (UTC)[reply]

−3, –3, and -3 are three different things; to wit a minus, an endash, and a hyphen. Dis sayin' ... --Brogo13 (talk) 20:15, 11 February 2020 (UTC)[reply]

I explained the problem, which is unrelated to this article, at my talk. Johnuniq (talk) 23:12, 11 February 2020 (UTC)[reply]
The problem, according to your edit summary, was my script—I have none. I simply found some hyphens masquerading as dashes and some where minus signs would make sense e.g. west longtitudes and south latitudes. (Why they work but minuses don't is still beyond me.) --Brogo13 (talk) 03:12, 12 February 2020 (UTC)[reply]
Template parameters expect numbers to be numbers, for example 12.3 or -12.3 (that's a hyphen which is the universal symbol for a negative number in programming languages). Some code in MediaWiki accepts a minus sign as equivalent to negative but modules (using Lua) do not, not unless the module takes extra steps to convert minus signs to hyphens before interpreting the numbers. Minus signs are typographic symbols for humans. Johnuniq (talk) 03:47, 12 February 2020 (UTC)[reply]

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)[reply]

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)[reply]