User:DePiep/help/luadoc


 * wd


 * mw:ref manual
 * Wikibase Lua


 * module:Wikidata

general



 * exemplary



decode, encode &amp;nbsp;

 * Module:decodeEncode decode, encode

3 x 4 table

 * To read the "b3" value, and then write a new value to it, you would do this:

Mr. Stradivarius 13:29, 11 May 2014 (UTC)

ucfirst


Jackmcbarn 20:36, 13 April 2014 (UTC)
 * You can also use mw.language.getContentLanguage:ucfirst(str). — Mr. Stradivarius 12:30, 22 April 2014 (UTC)
 * Or mw.ustring.gsub("^.", mw.ustring.upper). — Eru·tuon 01:33, 8 July 2018 (UTC)

Wikipedia_talk:Lua How_to_use_a_string_read_as_tablename?

 * 06:08, 23 April 2022 (UTC)
 * 06:08, 23 April 2022 (UTC)

I have read a variable as string, say. Now I want that name to be used as a table id:. This produces an error (like "error input variable 1: table expected, got string"). How can I use that string as table-name in there? (note: the table name is known beforehand, from a limited list of five, so is declared as ). In code, essense lines: DePiep (talk) 06:20, 22 April 2022 (UTC)
 * Johnuniq 07:23, 22 April 2022 (UTC)
 * Hmm, I just read this again. Are you saying you want the name of the table to be determined when the program runs? You can't do that in Scribunto's Lua. You would need to have a series of if...elseif...end tests to work out which table to use. If you describe the problem a bit more I can provide an example. Johnuniq 07:26, 22 April 2022 (UTC)

As Johnuniq said, but to avoid if...elseif...end tests use a table of all five tables like in This returns "4; 5; 6; someValue1". I introduced "operate_on" for the case your sInput does not match any of the tables, but you probably do not need it. User:Ponor 08:41, 22 April 2022 (UTC)

args and metatables
Johnuniq on how frame is not empty:

Mr Strad detailing metatable: Johnuniq on frame & arg Yes, that's easy. If a page contains  and Template:Example contains , and after the above code,   is 'hello' and   is 'abc' while   is 'def'. Johnuniq (talk) 06:27, 7 August 2014 (UTC)
 *