-4
function writeFloat([=[==[===[====["game.exe"+XXXXXXXX]+XXX====]+XXX===]+XXX==]+XXX=]+XXX, trackbar_getPosition(TRAINERFORM_CETrackBar1))
end

gives me the error

[string "--code..."]:4: unfinished long string near

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
user5888870
  • 21
  • 1
  • 2

1 Answers1

3

Lua has "long strings", which are induced by the syntax of [=*[, where "=*" means "zero or more = characters". So [[ begins a long string, as does [==[ or [=[, as in your case.

A long string is so named because it accepts every character between the inducing syntax and the terminating syntax. This allows you to do useful things like add verbatim XML, C++, or even Lua code within your Lua script as a literal string.

The terminating syntax is ]=*], where "=*" means the exact same number of = characters that was used to induce the long string. So if you start with [=[, the long string will only end with ]=]. ]] and ]====] or any other terminus will not end the long string; they'll be taken verbatim into the string.

So this:

local lit = [=[Long String]==]=]

Results in lit taking the value Long String]==.

In your code, you never see a ]=] sequence. You have ====] and similar things, but they don't even start with a ] character.

It is illegal to start a long string that never ends in a Lua script. Hence the compile error.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982