Manual talk:Coding conventions/Lua
Add topicAppearance
Latest comment: 1 year ago by Tgr (WMF) in topic This doesn't match MediaWiki coding conventions
This doesn't match MediaWiki coding conventions
[edit]This was taken from enwiki's conventions for writing modules on that wiki, and does not match the coding conventions for Lua code in MediaWiki extensions such as Scribunto. I could fix it, which would change several things here, or this could be removed back to enwiki if they want their conventions to remain the same. Anomie (talk) 14:03, 25 November 2015 (UTC)
- Anomie, it's quite late, but could you perhaps do it? It would be good to at least have the convention in extensions documented, and it can act as a good global default. If the English Wikipedia wants to have something local, it's acceptable. --Amir E. Aharoni (talk) 07:07, 23 September 2018 (UTC)
- I just encountered the same problem. I got used to the MediaWiki coding convention on all file types, including Lua: spaces inside
( )
,{ }
, and even[ ]
. I just formatted a Lua file as so, and was about to reference this page, when I noticed it was diverging from the usual convention. By looking at the Scribunto repository, Lua files have spaces inside( )
,{ }
, but not inside[ ]
. Thus, here on mediawiki.org we should recommend spaces inside( )
,{ }
, but I'm not sure about the[ ]
(I think we should have spaces as well, but that's not what is done in the Scribunto repository). Od1n (talk) 07:09, 20 October 2023 (UTC)- +1 to adhering to MediaWiki conventions. â MusikAnimal talk 17:22, 20 October 2023 (UTC)
- MediaWiki PHP code doesn't usually spaces in
[ ]
(when used as array index) either. Tgr (WMF) (talk) 00:12, 22 October 2023 (UTC)
- I just encountered the same problem. I got used to the MediaWiki coding convention on all file types, including Lua: spaces inside