It is currently March 28th, 2024, 12:53 pm

How to use inline lua?

Get help with creating, editing & fixing problems with skins
Post Reply
person_whoexists31
Posts: 5
Joined: June 8th, 2021, 12:41 pm

How to use inline lua?

Post by person_whoexists31 »

Still not clear with the docs. Does anyone know how to use inline lua? (or/and require a file?)

looking for something like: [execlua:'readFile("stuff.txt")']
person_whoexists31
Posts: 5
Joined: June 8th, 2021, 12:41 pm

Re: How to use inline lua?

Post by person_whoexists31 »

found it
```
[MeasureScript]
Measure=Script
ScriptFile=filenamehere.lua
Disabled=1
```
and
```
[&MeasureMyScript:GetCharaceterInString('Rainmeter', 5)]
```
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to use inline lua?

Post by jsmorley »

Skin:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[&execlua:readFile('#CURRENTPATH#Test.xml')]

[execlua]
Measure=Script
ScriptFile=Test.lua
Disabled=1

[MeterFile]
Meter=String
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Lua:

Code: Select all

function readFile(arg)

	file = io.open(arg)
	fileTxt = file:read('*all')
	file:close()
	
	SKIN:Bang('!SetOption', 'MeterFile', 'Text', fileTxt)

end
Test.xml:

Code: Select all

<item>
<Name1>Bob</Name1>
<Name2>Sue</Name2>
</item>

1.jpg
person_whoexists31
Posts: 5
Joined: June 8th, 2021, 12:41 pm

Re: How to use inline lua?

Post by person_whoexists31 »

jsmorley wrote: June 8th, 2021, 12:57 pm Skin:

Lua:
Thanks for the help! (+1)
Post Reply