PDA

View Full Version : Help me using Lua function



Ron
October 13th, 2002, 03:55 PM
Here are the translated statements:



Track = strsub(Track, strfind(Track,".")+3, strfind(Track, " - Winamp") - 3)
TrackPos = format("%d:%.2d", TrackPosM, TrackPosS)


Please consult the manuals for the explanations of these functions.

Mark F
October 13th, 2002, 03:55 PM
I don't know of a function used to delete variables in LUA.

LUA supports the concept of local variables, though. These variables have the scope of the current routine or block and are automatically deleted when the current routine or block is exited. Example -


local Var1
Var1 = 3
print(Var1)
Var1 = "help me"
print(Var1)

Run this code from the script editor and you should get the results -
3
help me

Script finished.
Return value=0

Open the variable window and Var1 will NOT be present as it was already deleted.

I don't know if a local variable will work for your particular case but I thought I'd mention it. :)

mitko
October 13th, 2002, 03:55 PM
This is the way to delete a global variable


VarName = nill

choco140
October 13th, 2002, 03:55 PM
Hi everybody,

So far I was using GVMS with the following functions to get WinAMP song titles, but since I switched for the 3.2.5 version, they don't work anymore.

Could anybody kindly help me by translating them in the new language since I am a really bad programmer and didn't figure out how to do it :(


Those functions are:

Track=cut(Track, substr(Track,". ",0)+2, substr(Track," - Winamp",0)-3);

and

TrackPos = format("%d",TrackPosM)+":"+format("%.2d",TrackPosS);

Sorry, I don't even understand what those funtions stand for...

Lastly how can I delete a variable, it was pretty easy using GVMS since it was simply delete variable, but in Lua I don't know how to do it.

Thanks.

choco140
October 13th, 2002, 03:55 PM
Thanks Ron,

I read the entire manual yesterday but couldn't find how to delete a variable, so is it simply possible to do so?

Cheers.

choco140
October 13th, 2002, 03:55 PM
Thanks for that man!