It is currently July 27th, 2021, 4:06 pm

How to use inline lua?

Help with creating, editing & fixing problems with skins
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")']
amogus is pog
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)]
```
amogus is pog
User avatar
jsmorley
Developer
Posts: 21976
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
You do not have the required permissions to view the files attached to this post.
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)
amogus is pog