It is currently November 30th, 2021, 3:23 am

Using Lua to read files

Discuss the use of Lua in Script measures.
Posts: 2
Joined: August 24th, 2014, 9:05 pm

Using Lua to read files

Post by tuxwonder »

I'm havin trouble

I want to create a skin with multiple shortcuts to different programs and folders which is also easy to customize (For my friends use or whatever)

The first way I could think of was to make it so if you wanted to have a shortcut, you'd enter the file path into a text document, and the Lua script would show a meter on the skin with the shortcut. Each line on the document would represent a shortcut. The script decides which meters to show and what paths to send the user to.

However, I'm not sure how, or even if, I can make Lua read a text file. Is it possible, and how would I do it?
User avatar
Posts: 1084
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Using Lua to read files

Post by Mordasius »

Using Lua for something like this is somewhat akin to using the proverbial sledgehammer to crack a nut. You can assign the shortcut paths as variables in a separate .inc (include) file for easy editing along with a host of other methods of varying complexity that don't involve a lua script.

I suggest you take a look at some of the launcher skins in the Rainmeter group galleries on Deviant Art. I'm sure you'll find something there that you can use to build your own customisable launcher. If you get stuck along the way just come back here and let us know what's going wrong.