https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115058
Revision: 115058
Author: tstarling
Date: 2012-04-26 04:46:49 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Allow debug.traceback
Modified Paths:
--------------
trunk/php/luasandbox/library.c
Modified: trunk/php/luasandbox/library.c
===================================================================
--- trunk/php/luasandbox/library.c 2012-04-26 00:18:32 UTC (rev 115057)
+++ trunk/php/luasandbox/library.c 2012-04-26 04:46:49 UTC (rev 115058)
@@ -128,7 +128,19 @@
lua_pushcfunction(L, luasandbox_math_randomseed);
lua_setfield(L, -2, "randomseed");
lua_pop(L, 1);
-
+
+ // Allow debug.traceback. Equivalent to Lua code:
+ // debug = {traceback = traceback}
+ // Stack deltas are shown in each comment below
+ lua_pushcfunction(L, luaopen_debug); // +1
+ lua_call(L, 0, 0); // -1
+ lua_createtable(L, 0, 1); // +1
+ lua_getglobal(L, "debug"); // +1
+ lua_getfield(L, -1, "traceback"); // +1
+ lua_setfield(L, -3, "traceback"); // -1
+ lua_pop(L, 1); // -1
+ lua_setglobal(L, "debug"); // -1
+
// Install string-related functions
luasandbox_install_unicode_functions(L);
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs