matej_suchanek created this task.
matej_suchanek added projects: Wikidata, Wikibase-Lua,
MediaWiki-extensions-WikibaseClient.
Restricted Application added a subscriber: Aklapper.
TASK DESCRIPTION
Run the following module from the console (`= p.test()`):
local p = {}
function p.test()
local entity, statements
entity = mw.wikibase.getEntity('Q213')
statements = entity:getAllStatements('P1082')
mw.log(#statements)
table.remove(statements)
mw.log(#statements, #entity:getAllStatements('P1082'),
#entity.claims.P1082)
entity = mw.wikibase.getEntity('Q213')
statements = entity:getBestStatements('P1082')
mw.log(#statements)
table.remove(statements)
mw.log(#statements, #entity:getBestStatements('P1082'),
#entity.claims.P1082)
end
return p
(`table.remove` performs //in-place removal// of the last element in the
sequence.)
You will get:
35
34 34 34
1
0 1 35
In other words, changing the value returned from `getAllStatements` will
change it for all following calls and also change the entity object.
This does not happen with `getBestStatements`.
TASK DETAIL
https://phabricator.wikimedia.org/T270851
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: matej_suchanek
Cc: matej_suchanek, Aklapper, Akuckartz, Nandana, lucamauri, Lahi, Gq86,
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS,
Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs