Welcome! Log In Create A New Profile

Advanced
Lua string character spacing question
June 07, 2022 03:18PM
So I have been trying to make a plugin that can take the selected executor variable number and return the number into a macro that I can load from.

However I have found there's an issue with the spacing in the assign macro line where I can't get the space between the "load" keyword and the getvar variable to string together properly with out the getvar variable number being recognised as part of the macro place number, or that's what I assume is happening.

Example:


function main()
local getvar = gma.show.getvar("SELECTEDEXEC")
gma.cmd("store macro 1.108")
gma.cmd("Assign macro 1.108" .."/cmd=" .."Load " ..getvar)
end
return main

This outputs the following

"Assign Macro 1.108 1.4.116 /cmd=Load" instead of
"Assign Macro 1.108 /cmd= Load 1.4.116"

*Edit*

I have found a solution, I needed to put spaces either side of the "load and "executor" keywords as well as putting a "\"" infront of the "/cmd=".

function main()
  gma.cmd("assign macro 1.108" .. "/cmd=\"" .. " load " .. " Executor " .. gma.show.getvar("SELECTEDEXEC"))
end
return main



Edited 1 time(s). Last edit at 06/09/2022 02:38PM by Tarac12.
Subject Author Views Posted
Lua string character spacing question Tarac12 303 June 07, 2022 03:18PM
Re: Lua string character spacing question speedyg 110 June 12, 2022 03:41PM



Sorry, only registered users may post in this forum.

Click here to login