Jackmcbarn has uploaded a new change for review.

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

Change subject: Expose frame.depth
......................................................................

Expose frame.depth

Add frame:getDepth() to Lua, returning $frame->depth from PHP.

Change-Id: Ie6b9a9405b2cc7431c2790e3a1b10bf48b05e425
---
M engines/LuaCommon/LuaCommon.php
M engines/LuaCommon/lualib/mw.lua
2 files changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/52/141052/1

diff --git a/engines/LuaCommon/LuaCommon.php b/engines/LuaCommon/LuaCommon.php
index 30bab14..87f3a75 100644
--- a/engines/LuaCommon/LuaCommon.php
+++ b/engines/LuaCommon/LuaCommon.php
@@ -98,6 +98,7 @@
                                'incrementExpensiveFunctionCount',
                                'isSubsting',
                                'getFrameTitle',
+                               'getFrameDepth',
                        );
 
                        $lib = array();
@@ -448,6 +449,18 @@
        }
 
        /**
+        * Handler for getDepth()
+        *
+        * @param $frameId
+        *
+        * @return array
+        */
+       function getFrameDepth( $frameId ) {
+               $frame = $this->getFrameById( $frameId );
+               return array( $frame->depth );
+       }
+
+       /**
         * Handler for getExpandedArgument()
         */
        function getExpandedArgument( $frameId, $name ) {
diff --git a/engines/LuaCommon/lualib/mw.lua b/engines/LuaCommon/lualib/mw.lua
index 5d562c1..b408f38 100644
--- a/engines/LuaCommon/lualib/mw.lua
+++ b/engines/LuaCommon/lualib/mw.lua
@@ -453,6 +453,11 @@
                return php.getFrameTitle( frameId )
        end
 
+       function frame:getDepth()
+               checkSelf( self, 'getDepth' )
+               return php.getFrameDepth( frameId )
+       end
+
        -- For backwards compat
        function frame:argumentPairs()
                checkSelf( self, 'argumentPairs' )

-- 
To view, visit https://gerrit.wikimedia.org/r/141052
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6b9a9405b2cc7431c2790e3a1b10bf48b05e425
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to