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(a)wikimedia.de>
Reply-To: Wikimedia developers <wikitech-l(a)lists.wikimedia.org>
To: wikitech-l(a)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
--
Jens Ohlig
Software developer Wikidata project
Wikimedia Deutschland e.V.
Obentrautstr. 72
10963 Berlin
www.wikimedia.de
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 Nz. Als gemeinnützig anerkannt durch das
Finanzamt für Körperschaften I Berlin, Steuernummer 27/681/51985.
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l