local startp = '[[[[pb]+120]+' -- start of Pointerpath
local endp = ']+11A0]' -- end of Pointerpath
local offsetResult = nil
local offsets = {0,8,10,18,20,28,30,38,40,48,50} -- offset Table
for i=1,#offsets do
offsetResult = startp .. offsets[i] .. endp
print(offsetResult) -- or readFloat or whatever
end
The Output :
[[[[pb]+120]+0]+11A0]
[[[[pb]+120]+8]+11A0]
....
Works as expected.
My question is :
String concatenation is claimed to be slow.
What is your experience ?
How would you solve such a Problem?
Most pure lua running time should be neglectable compare to inter-process memory read/write.
lua string concatenation is said to be inefficient mostly only when creating too many intermediate string within a heavy loop.
It seems your case is fine if just a few strings created once and done, ie the address strings are fixed, only the interpreted address content of the fixed symbols eg. pb or [pb] changed with time, which should be handled by CE internally.
Most pure lua running time should be neglectable compare to inter-process memory read/write.
lua string concatenation is said to be inefficient mostly only when creating too many intermediate string within a heavy loop.
It seems your case is fine if just a few strings created once and done, ie the address strings are fixed, only the interpreted address content of the fixed symbols eg. pb or [pb] changed with time, which should be handled by CE internally.
Thank you for your Answer.
After taking a nap, i came up with this solution. Spoiler
--on script activation
local startp = '[[[[pb]+120]+' -- ppstart
local endp = ']+11A0]' -- ppend
local offsetResult = nil
local offsets = {0,8,10,18,20,28,30,38,40,48,50} -- offsets
local results = {} -- result of concatination
for i=1,#offsets do
offsetResult = startp .. offsets[i] .. endp -- build pp string
table.insert(results,offsetResult) -- store pp string
end
-- in timed condition
for j=1,#results do
print(results[j]) -- or readFloat or whatever
end
No one said i have to do the concationation at "runtime"