lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 20.05.2015 um 14:29 schröbte Александр Машин:
    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.

LPeg registers its metatable under the name "lpeg-pattern", so you can retrieve it in C++ (after `luaopen_lpeg` has been called) with `luaL_getmetatable(L, "lpeg-pattern");` and store it in a global variable. But what do you need the LPeg metatable for?


Alexander Mashin


Philipp