It is currently April 19th, 2024, 10:29 pm

Ask some question about lua scripts,waitting for answers!

Discuss the use of Lua in Script measures.
ksamantha
Posts: 2
Joined: October 28th, 2013, 3:30 am

Ask some question about lua scripts,waitting for answers!

Post by ksamantha »

i'm first here ,and first time use lua scripts,there are some problems
1,dose lua scripts in rainmeter can use coroutine?
2,when i use Bang command 'WriteKeyValue' to write the value that has Variables like '#abc#',why finally write the Variables's value in the file ,i need these key use Dynamic values, so how can i write Variables use 'WriteKeyValue' command?
3,How to delete a Variable in rainmeter's lua scripts?
waitting for the answer,thank you very much.
i'm found answer to resolve the question 2,it's found at 3.0 manual 's 'Escaping Variables ' section,use like '#*abc*#' to write the Variables .
still 2 questions not answered ,hope someone told me ,thanks
i got another question from lua in rainmeter,is there a details about how many lua basic func that rainmeter can use ,because i try to use 'getfenv' and 'setfenv' but got errors about 'Script: progress.lua:107: attempt to call global 'getfenv' (a nil value)'
ksamantha
Posts: 2
Joined: October 28th, 2013, 3:30 am

Re: Ask some question about lua scripts,waitting for answers

Post by ksamantha »

i have got new question about SetVariable,when i need to set a long string with a lot of ' or "

Code: Select all

finishfunc='local inst,SKIN=...;'..
		'SKIN:Bang(''!SetVariable bar''..inst.n..''Title "loading complete." '');'
SKIN:Bang('!SetVariable newTaskBarCallbackTask """'..finishfunc..'""");')
and then error became :Script: progress.lua:114: unexpected symbol near ''!SetVariable bar''
so i change it to below

Code: Select all

finishfunc='local inst,SKIN=...;'..
		'SKIN:Bang(\'!SetVariable bar\'..inst.n..\'Title ""loading complete."" \');'
SKIN:Bang('!SetVariable newTaskBarCallbackTask "'..finishfunc..'");')
and it still got an err:DiskAnalysis\Progress\ProgressBar.ini: !SetVariable: Skin ");" not found
how can i set this string to Variable,where did i wrong,please help me.
update:
i found what wrong am i did ,the question is solved ,right code:

Code: Select all

local finishfunc='local inst,SKIN=...;'..
		'SKIN:Bang(\'!SetVariable bar\'..inst.n..\'Title \"loading complete.\" \');'
SKIN:Bang('!SetVariable newTaskBarCallbackTask """'..finishfunc..'"""')
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Ask some question about lua scripts,waitting for answers

Post by thatsIch »

ksamantha wrote:i'm first here ,and first time use lua scripts,there are some problems
1,dose lua scripts in rainmeter can use coroutine?
2,when i use Bang command 'WriteKeyValue' to write the value that has Variables like '#abc#',why finally write the Variables's value in the file ,i need these key use Dynamic values, so how can i write Variables use 'WriteKeyValue' command?
3,How to delete a Variable in rainmeter's lua scripts?
waitting for the answer,thank you very much.
i'm found answer to resolve the question 2,it's found at 3.0 manual 's 'Escaping Variables ' section,use like '#*abc*#' to write the Variables .
still 2 questions not answered ,hope someone told me ,thanks
i got another question from lua in rainmeter,is there a details about how many lua basic func that rainmeter can use ,because i try to use 'getfenv' and 'setfenv' but got errors about 'Script: progress.lua:107: attempt to call global 'getfenv' (a nil value)'
1. I don't think so, else I would have used it already :)
3. You don't. If you are desperate you can parse the ini and remove the line containing the varible.
4. afaik not all are supported or deactivaed through security or other reason. The one I already used and thus know they work are
  • assert
  • dofile
  • _G
  • getmetatable
  • ipairs
  • next
  • print
  • setmetatable
  • tonumber
  • tostring
  • type