Module:String

From hyperspacewiki
Revision as of 04:38, 19 December 2018 by Jflopezfernandez (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

String Module

The original source code for this module was taken from the Wikipedia String Module but had to be re-written because the Wikipedia code used an overly general method for getting the function parameters that resulted in a null reference error. I simplified the argument referencing which solved the error.

Functions

Length

Returns the length of the passed-in string.


local str = {}

function str.len( frame )
    local s = frame.args[1]
    
    return mw.ustring.len( s )
end

return str