Actually, the issue is a little more subtle. The @variable syntax isn't really part of Lua. Nick supports it by running your Send content through a preprocessor, which processes it before Lua does. It looks for the @variable and %1 things, looks up what their values are right at that moment, and then replaces them inline. So if you have this:
if "@variable" == "test" then
... then by the time Lua gets to it, it's actually (example):
if "test" == "test" then .
Got it? Now, what's going on is that it gets those values before you ever call SetVariable to change their values. You -are- changing the values, but it's not seeing that, because it already got the values beforehand. What you should do in this case is this:
SetVariable ("hp","%1")
SetVariable ("maxhp","%2")
SetVariable ("ftg","%3")
SetVariable ("maxftg","%4")
SetVariable ("mana","%5")
SetVariable ("maxmana","%6")
Send (string.format("'%s %s", GetVariable("hp"), GetVariable("maxhp")))
Send (string.format("'%s %s", GetVariable("ftg"), GetVariable("maxftg")))
Send (string.format("'%s %s", GetVariable("mana"), GetVariable("maxmana")))
I used string.format because it looks tidier than a bunch of concatenations. ;) And in case you were wondering, the %s things in the string.format call are not bothered by the preprocessor, since those are letters, not numbers. |