MA2 Lua 函数库

  1. 主页
  2. 文档
  3. MA2 Lua 函数库
  4. gma.show.setvar()【MA变量赋值函数】

gma.show.setvar()【MA变量赋值函数】

函数名:变量赋值函数
调 用:gma.show.setvar(string:varname,string:value)
参 数:第一个参数为字符串:变量名字(MA系统中的变量)
第二个参数为字符串:赋值
返回值:
结 果:为给定的变量赋值
备 注:在MA命令反馈窗口中列出所有变量,可使用命令 ListVar

例子:

  • 以下为获取当前执行器所指派的程序序列的程序模块
local selectedSequence = function()
local seq
local get = gma.show.getobj
local h = get.handle('Cue') ------ 'cue'为当前执行器运行中的程序步
if h and get.class(h) == 'CMD_CUE' then
    seq = get.parent(h)
    num = get.number(seq)
    gma.feedback ("the number of sequence = "..num)
    gma.show.setvar ("_sequencenum",num)

    elseif h and get.class(h) == 'CMD_SEQUENCE' then ---当无运行程序步时则往上索源序列
        seq = h
        num = get.number(seq)
        gma.feedback ("the number of sequence = "..num)
        gma.show.setvar ("_sequencenum",num)
    end
    return false
end
return selectedSequence;
  • 当如果指派给执行器的是 Effect 或者 Macro 的时候,以上模块则失效,改用以下笨办法:
return function()
    gma.cmd('Label Executor $selectedexec JohnDoe')
    local handle=gma.show.getobj.handle('Root *.*.JohnDoe')
    gma.show.setvar('_TYPE',gma.show.getobj.class(handle):sub(5))---'sub()'为从第五个字符往后
    gma.show.setvar('_ID',gma.show.getobj.number(handle))
    gma.cmd('Oops /nc')
    gma.cmd('ListVar _*')
end
标签 ,
这篇文章对您有用吗?

发表回复

您的电子邮箱地址不会被公开。