Forwarding from wikitech-l; discussion will be there.
-------- Original Message -------- Subject: [Wikitech-l] Extending Scribunto with new Lua functions Date: Mon, 4 Feb 2013 14:46:44 +0100 From: Jens Ohlig jens.ohlig@wikimedia.de Reply-To: Wikimedia developers wikitech-l@lists.wikimedia.org To: wikitech-l@lists.wikimedia.org
Hello,
I guess this can be answered by Tim or Victor, but I'm grateful for any pointers that can help me with a rather specific problem with Scribunto.
I'm currently working on the Wikidata project to include Lua functions for templates that access Wikidata entities.
I've toyed around a bit and extended LuaCommon.php with a getEntities function and a wikibase table to hold that function. Now I wonder if there are any plans for Lua extensions outside the mw.* namespace.
I've added a wikibase.lua file and a wikibase.* namespace in Lua. However, the way PHP and Lua play together and how Scribunto can be extended looks a bit like black magic (which is to be expected, given that Scribunto is far from finished).
Here are my questions: 1. Is there an easy way to add your own Lua functions (that call PHP Api functions) to Scribunto other than writing them into LuaCommon.php? 2. Is using your own namespace the way to go? 3. Are there some kind of examples how to wrap PHP functions into the Lua environment (using the frame etc)? 4. Is there any way to introspect or debug such wrapped functions?
Thanks for any suggestions!
Cheers, Jens
wikitext-l@lists.wikimedia.org