विकिपीडिया:लुआ: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
imported>Wikid77
created, as a Wikipedia essay, to explain use of Lua script modules in Wikipedia
(कौनों अंतर नइखे)

19:15, 16 फरवरी 2013 तक ले भइल बदलाव

This essay, wp:Lua in Wikipedia, explains issues about using Lua script on Wikipedia, rather than wikitext markup language. To run Lua script, the Lua source code is stored in pages called "modules" then invoked (by "#invoke") from a "template" which contains markup instead. The interface in the MediaWiki software to run Lua script is called Scribunto. Lua was installed on enwiki in February 2013, after testing on test2.wikipedia.org.

About Lua

Lua is a scripting language which can be used to analyze data, calculate expressions, and format results using functions or object-oriented programming. Although some Lua script can be kept simple, for easy understanding, Lua allows complex structures which would challenge a computer scientist, with tables, dynamic functions, and associative arrays where index subscripts can be words as well as index numbers. Lua also supports recursion of re-nested functions or allows coroutines for cooperative multitasking, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua source code for a factorial function:

  function factorial(n)
    if n == 0 then
      return 1 --this returns the result 1 when passed zero
    else
      return n * factorial(n - 1)
    end
  end
  for index = 1,5 do
      print(index, "n! = ", factorial(index) )
  end

A sample of Lua is highlighted by tag "<syntaxhighlight lang="lua">...</syntaxhighlight>" placed around the Lua source code. To view some more complex examples of Lua, see article: "Lua (programming language)".

History on Wikipedia

Although discussed for years, Lua was installed in 2012 for testing on test2.wikipedia.org, with open invitation to all editors to experiment with developing Lua modules. A central page was developed on meta:

Tracking of Lua modules can be done by PrefixIndex:

Groups of Lua-based templates can be seen in categories:

As more is available about Lua, then this essay will be edited to provide additional information.

[ This essay is a rough draft to be expanded later... ]