Code: Select all
; skin.ini file
[MeasureString]
Measure=String
String=AStringValue
OnUpdateAction=!CommandMeasure "MeasureScript" "StringLength([MeasureString])"
[MeasureScript]
Measure=Script
ScriptFile=Script.lua
Code: Select all
; Script.lua file
function StringLength(a)
b = string.len(a)
print(b)
end
So here is my workaround wich works for any string value, of any length. It takes 2 updates (1 update after the change of the string measure)
Code: Select all
; skin.ini file
[MeasureString]
Measure=String
String=AStringValue
[MeasureStringLengthSub]
Measure=String
String=[MeasureString]
DynamicVariables=1
RegExpSubstitute=1
Substitute=".":"+1","^(.+)":"0\1"
[MeasureCalc]
Measure=calc
Formula=[MeasureStringLengthSub]
DynamicVariables=1
OnChangeAction=!log [MeasureCalc]
We then get the string value of MeasureStringLengthSub and compute it with MeasureCalc.
Hope i didn't make any mistakes, and hope it will be usefull in some ways .