Page MenuHomePhabricator

sequence in Lua should start with 1 but starts with 0
Closed, ResolvedPublic

Description

Quoting from https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team#.270.27_key_in_Lua_tables

"The most standard Lua tables are "sequence" where the key are natural numbers starting from 1, but Wikibase tables seem to have a key "0". It is a bit annoying. According to the documentation, "Many Lua functions operate only on sequences, and ignore non-positive-integer keys." For instance, the number of claims for a property, as given by #entity.claims.pXX is one less than expected. --Zolo (talk) 09:49, 19 September 2013 (UTC)"


Version: master
Severity: normal

Details

Reference
bz54324

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:01 AM
bzimport set Reference to bz54324.
bzimport added a subscriber: Unknown Object (MLST).

Change 94909 had a related patch set uploaded by Jens Ohlig:
(bug 54324) sequence in Lua should start with 1

https://gerrit.wikimedia.org/r/94909

Change 94909 abandoned by Jens Ohlig:
(bug 54324) sequence in Lua should start with 1 Patch set 2: Reformatted Patch set 3: Oops, I meant to reformat it like this. Patch set 4: ...

https://gerrit.wikimedia.org/r/94909

Change 96232 had a related patch set uploaded by Jens Ohlig:
(Bug 54324) Sequences in Lua should start with 1

https://gerrit.wikimedia.org/r/96232

Change 96232 abandoned by Hoo man:
(Bug 54324) [DON'T MERGE] Sequences in Lua should start with 1

Reason:
Superseded by https://gerrit.wikimedia.org/r/106905 (which implements this behavior, but doesn't make it default)

https://gerrit.wikimedia.org/r/96232

Change 107206 had a related patch set uploaded by Hoo man:
Introduce mw.wikibase.entity Lua library

https://gerrit.wikimedia.org/r/107206

The listed patch will introduce a new mw.wikibase method which does that right, but leave the old legacy interface in place.

Change 107206 merged by jenkins-bot:
Introduce mw.wikibase.entity Lua library

https://gerrit.wikimedia.org/r/107206

Fixed for the new Lua interface, the legacy one will stay in place for now