Topic on Extension talk:Scribunto

PerfektesChaos (talkcontribs)

Hi all,

I would like to see something like a mw.expr Scribunto library function rather than the following call, even worse when no frame object present in local function:

mw.getCurrentFrame():callParserFunction( "#expr",  { "1+1" } )

There is already Extension:ParserFunctions/Extended #Expr.php (extended) which could be used without any prerequisites. Any project which installed ParserFunctions might use it, but even some more. I am not an expert in questions of extension integration, but it seems to me not a big deal to import Expr.php into Scribunto environment.

Currently there is one single function appearing in this “library”. That might be a mw.util.expr() function, leaving space in mw.util for further helpful functions.

Greetings

Anomie (talkcontribs)

What are you doing with #expr that you can't just do in Lua?

PerfektesChaos (talkcontribs)

My users are passing over expressions as template parameter values in place of numeric figures. I am the service staff who is supposed to evaluate that. The usage is reasonable in template programming, at least for the time being before all template programming has been rewritten in Lua.

Looking at a proposed mw.util, the current mw.allToString() or mw.clone() might reside there in future, supporting previous location of course. I would prefer to see a collection of utilities rather than a pile of less central methods. Important features like mw.log() should be present at top level anyway.

Best wishes

Reply to "Suggestion: mw.expr"