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

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz54324.
Lydia_Pintscher created this task.Via LegacySep 19 2013, 2:35 PM
gerritbot added a comment.Via ConduitNov 12 2013, 3:35 PM

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

gerritbot added a comment.Via ConduitNov 18 2013, 2:13 PM

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

gerritbot added a comment.Via ConduitNov 19 2013, 10:14 AM

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

gerritbot added a comment.Via ConduitJan 11 2014, 6:25 PM

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

gerritbot added a comment.Via ConduitJan 23 2014, 11:46 PM

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

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

hoo added a comment.Via ConduitJan 23 2014, 11:49 PM

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

gerritbot added a comment.Via ConduitFeb 7 2014, 11:55 AM

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

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

hoo added a comment.Via ConduitFeb 7 2014, 12:26 PM

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

Add Comment