Posted: Sun Aug 08, 2021 7:56 pm Post subject: help with lua workaround/error
I am using a script to multiply the amount of some velocities every second, it works fine when the pointers are found, but when the pointers are ?? i get a lua error " attempt to perform arithmetic on a string value (field 'Value')" and since this repeats every second it gives me an error every second. Is there any work around for this?
code:
Code:
{$lua}
local al = getAddressList()
local lpvx1 = al.getMemoryRecordByDescription("LPVelX1")
local lpvz1 = al.getMemoryRecordByDescription("LPVelZ1")
local mp = 1.5
[ENABLE]
function enable(timer)
The Value property of memory records is a string. Use tonumber to explicitly convert it to a number, and only continue if that succeeds (i.e. doesn't return nil).
Code:
local x,z = tonumber(lpvx1.Value), tonumber(lpvz1.Value)
if x and z then
...
end
_________________
I don't know where I'm going, but I'll figure it out when I get there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum