LREMisc - guiled/LRE GitHub Wiki

Misc

LRE provides some general functions that can be useful.

firstInit

Like the basic init() function, LRE provides a way to run an init only once for a sheet. This can be useful if you want to prepare some component for the very beginning. Use this function in your script like this :

// At the same level than init
firstInit = function (sheet) {
    /*
     your code here
    */

    return true;            // true means that the first Init has be done and won't be done again
};

If firstInit returns true then it won't be launched on this sheet again. If it returns false the firstInit will be launched on the next table reload.

setLogLevel autoNum autoTransl numToAlpha alphaToNum isObject ...

  • strlen(string) : because of SB-62 String.length always returns 0, strlen is a workaround. Don't use it too much as it is a quite slow.
  • isNaN(): this basic javascript function is not defined in Let's Role, it returns true if the parameter is not a number.
  • mt_rand(min, max) : give a random integer between min and max inspired from php function mt_rand()