PDA

View Full Version : 5E number_abilityscores.lua / update(bool) question



Varsuuk
March 24th, 2019, 06:47
In 5E's number_abilityscore.lua file there is the following:


function onInit()
super.onInit();
onValueChanged();
end

function update(bReadOnly)
setReadOnly(bReadOnly);
end

function onValueChanged()
...


What is the use for update(true/false)?
It appears it is to setReadOnly. What is that used for? Is there a scenario where in 5e it locks a number field or unlocks it programmatically?


(I tried searching on "update(" i my eclipse but hit too many things. Using the lua perspective doesn't help as references menu option never works for me in eclipse, it just says "... please select a valid Lua element name" - so figured ask versus read it ALL ;) )

damned
March 24th, 2019, 08:40
When you click the Padlock on a record it uses the setReadOnly

Varsuuk
March 24th, 2019, 15:47
I’m not by the computer, I’ll check in but - I get that dara may be locked/unlocked, what confused me is how does this apply to number_abilityscore?

Not to mention, why go through the trouble of adding a function “update(bool)” that calls “setReadonky(bool)” when it appears to me to be doing no “value add”. It isnt intercepting setReadOnlyband decorating it - it isn’t making something public that was private it isn’t IMPROVING the naming ;) the original setReadOnly(book) says it all much more clearly without needing to look at the method.

PS - If it is some way to set my ability scores to read only - I’ll probably use it, I’ve been known to accidentally mess stuff up due to mouse keybinds while playing.