lua fltk scripting help for mpd clientForum: Programming and Scripting Topic: lua fltk scripting help for mpd client started by: dare2dreamer Posted by dare2dreamer on June 07 2006,05:22
I'm hoping someone has better scripting skills than I do, because I could really use some help. I'm working on a simple gui front-end for the mpc extension in the myDSL repository.I've got the basic buttons working, but I'm having a heck of a time with the volume slider. I can get it to update the mpd server's volume without a hitch, but I cannot for the life of me get it to read in the server's current volume on startup of the script. Can someone please take a look? I'd love to get this working so I can submit it to both the repository, and the musicpd.org website. I promise I'll tidy my (currently awful) code up before I release anything.
Posted by clacker on June 07 2006,14:25
dare2dreamer, the execute function returns the exit code for the command you run, not its output. There may be better ways, but here's one way of getting the output of a function into a string:
The tmpfile() function gives you a unique string for your temp file's name. The .. in the execute is a concatination of the two strings. You may need to use gsub function to remove the trailing return character. Posted by mikshaw on June 07 2006,14:41
Personally I'd rather have a more direct way to access an app's stdout/stderr in lua fltk, but so far that redirect to file seem to be the best alternative. It would be sweet to be able set a variable according to stdout like the Bash $(command) or `command`.One note, clacker: You can use "remove(myfilename)" instead of calling an external rm. |