I'm not familiar with the MediaWiki sandbox, but did you give LuLPeg
a try? It is a pure Lua implementation.
https://github.com/pygy/lulpeg/ If the sandbox is based on Lua 5.1
and disables `newproxy()`, you'll have to use
LuLPeg.L(LuLPeg.P(...)) rather than #LuLPeg.P(...) Otherwise, it is
compatible, but slower.
Thank you for this information. Unfortunately, this library depends on
load () and loadstring () functions, among others, switched off in
Scribunto.
By the way, I found the reason why getmetatable (lpeg.P()) == nil.
Scribunto also altered getmetatable () to return nils for all datatypes
save table. So, the issue now is how to export this metatable from C++
to Lua global space so it could be addressed by some name.