Home - guiled/LRE GitHub Wiki

Let's Role Enhanced !

What is LRE ?

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 ?

LRE 7 is a major improvement of LRE, fully written in typescript and fully tested.

Usage

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 options

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 to parseInt()). 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

LRE features and improvements

  • Sheet : enhanced capabilities and few more functions
  • Tables : create a table by script, many new functions
  • Components : enhanced capabilities, many new functions
  • Repeaters : easiest way to handle them
  • Choices and Multichoices : new functions
  • Containers : a new way to handle them and their children
  • Checkbox : few more functions
  • Toggles : a new component to handle icon changing on click
  • Data providers : a powerful way to handle data dynamically
  • LRE global functions: few useful functions
  • Component groups : a new component to group other components
  • Logs : a clear useful way to send to log and have a clearer error report
  • Events : a powerful new way to handle events

Breaking changes from LRE 6

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 = true is now replaced by lre.autoNum(true).
  • lre() still works but prefer using lre.init() instead.
  • component.on() replaces the previously defined event of the same type. Use the LRE aliased event notation like component.on("update:second", …)
  • isObject() is replaced by lre.isObject()
  • numToAlpha() and alphaToNum() are respectively replaced by lre.numToAlpha() and lre.alphaToNum()
  • repeater event change has been rename entrychange.