-
Notifications
You must be signed in to change notification settings - Fork 1
Home
LRE (for Let's role enhanced) is a utility to facilitate use of some features of Let's role that are a bit tricky. LRE adds some more features to enhance let's role scripting experience.
LRE 7 is a major improvement of LRE fully written in typescript and fully tested.
LRE is easy to insert into your project. Copy/paste the content of the latest lre.js release, and change your init by adding lre( … ) around the function.
init = lre.init(function (sheet) {
// your init code
});
initRoll = lre.initRoll(function (result, callback) {
// your initRoll code
});You now have a richer sheet parameter that will give you rich components. See the Sheet documentation
LRE has some optional behaviors that must be manually activated
-
LRE.setLogLevel()in order to use the log feature provided by LRE -
LRE.autoNum()that will convert all numeric value into numbers from components, tables, etc. (say goodbye toparseInt()). See the doc here -
LRE.autoTransl()that will translate all non numeric string value from components, tables, etc. (say goodbye to_()as well). See the doc here
- Sheet
- Tables
- Components
- Repeaters
- Choices and Multichoices
- Containers
- Checkbox
- Toggles
- Data providers
- LRE global functions
- Component groups
- Logs
- Events
-
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. - firstInit : this function can be declared like init and will be ran only once in whole life of a sheet. It takes one argument : an LRE Sheet. It must return a boolean to indicate that this firstInit must be done again the next time (
return false) or must not be done again (return true) - mt_rand(min, max) : give a random integer between min and max inspired from php function mt_rand()
If you were already using LRE 6, you must consider the following breaking changes. The good counterpart is that LRE 7 comes with less breaking changes for vanilla Let's role scripting users. If you still want to use LRE 6.24, you can download it here
Here are the LRE6 features that won't work anymore.
-
LRE_AUTONUM = trueis now replaced bylre.autoNum(true). -
lre()still works but prefer usinglre.init()instead. -
component.on()replaces the previously defined event of the same type. Use the LRE aliased event notation likecomponent.on("update:second", …) -
isObject()is replaced bylre.isObject() -
numToAlpha()andalphaToNum()are respectively replaced bylre.numToAlpha()andlre.alphaToNum()