FANDOM


  • Does anyone know how to get #invoke scripts to work on my wiki. I am trying to get this bit code to work:

    {{{{{|safesubst:}}}#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}}}
    

    But #invoke scripts don't seem to work on my wiki, I just get a big red script error, it works here though. I thought Lua was supposed to be enabled by default for all wikis.

      Loading editor
    • You need to create a page called Module:String. Then copy this:

      return require('Dev:String')

      Yes, Lua is enabled by default in all wikis, but you didn't create such a module page or else you are invoking that doesn't exist.

        Loading editor
    • To be clearer, you cannot invoke a module that doesn't exist. You must first create the module before you can specify a require function, otherwise, the script does not know what you are attempting to require.

        Loading editor
    • Applemasterexpert wrote:

      You need to create a page called Module:String. Then copy this:

      return require('Dev:String')

      Yes, Lua is enabled by default in all wikis, but you didn't create such a module page or else you are invoking that doesn't exist.

      I'm pretty sure the String module is a standard Scribunto library, so I'm not sure this is a good example.

        Loading editor
    • there is some difference between library and module. you have to pay more attention on this stuff.

      module is not included by default for wikis.

        Loading editor
    • That helps, thanks. :)

        Loading editor
    • Fngplg wrote:

      there is some difference between library and module. you have to pay more attention on this stuff.

      Not all libraries are modules, but that doesn't prevent a module from being a library.

      This is a Global module, but is it just for reference? https://dev.fandom.com/wiki/Module:String

        Loading editor
    • i'm tell you that string library and string module it is two different things. do not be fooled by same names.

      there is no place for arguing or playing around terminology. string module is neither a standard scribunto library, a scribunto library or a library. this message is totally incorrect: string library it is shared lua library. all the world have this library. when the string module (this specific one, that we talking about right now) is a wrapper (scribunto specific), that provides an interface between string library and wikitext.

        Loading editor
    • Hmm, I see. Looking at Module:String it does way more than most wrappers, but I guess since Lua isn't a native part of MediaWiki, something like that is needed.

        Loading editor
    • this is incorrect, too. you don't need module:string to use string library in the lua module: scribunto (enabled by default) loads all the libraries. but you do need some module (not necessary the string one, you can write your own one, with wrappers and error handling) to use string library functions in the wikitext, because the only way to use lua output in the wikitext is scribunto extension (#invoke).

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.