---------------------
Code:
local Name = ""
local Pic = 0
local ATK1 = 0
local ATK2 = 0
local ATK3 = 0
local ATK4 = 0
local res = db.storeQuery("SELECT * FROM zz;")
if(res:getID() ~= -1) then
repeat
Name = res:getDataString("NAME")
Pic = res:getDataInt("PIC")
ATK1 = res:getDataInt("ATK1")
ATK2 = res:getDataInt("ATK2") << Line 24
ATK3 = res:getDataInt("ATK3")
ATK4 = res:getDataInt("ATK4")
until not res:next()
res:free()
end
----------------------
----------------------
The Error:
[05/04/2009 21:49:13] Lua Script Error: [MoveEvents Interface]
[05/04/2009 21:49:13] data/movements/scripts/monsters.luanStepIn
[05/04/2009 21:49:13] data/movements/scripts/monsters.lua:24: attempt to index local 'res' (a number value)
[05/04/2009 21:49:13] stack traceback:
[05/04/2009 21:49:13] data/movements/scripts/monsters.lua:24: in function <data/movements/scripts/monsters.lua:1>
---------------------------
What is wrong with this code?
Code:
local Name = ""
local Pic = 0
local ATK1 = 0
local ATK2 = 0
local ATK3 = 0
local ATK4 = 0
local res = db.storeQuery("SELECT * FROM zz;")
if(res:getID() ~= -1) then
repeat
Name = res:getDataString("NAME")
Pic = res:getDataInt("PIC")
ATK1 = res:getDataInt("ATK1")
ATK2 = res:getDataInt("ATK2") << Line 24
ATK3 = res:getDataInt("ATK3")
ATK4 = res:getDataInt("ATK4")
until not res:next()
res:free()
end
----------------------
----------------------
The Error:
[05/04/2009 21:49:13] Lua Script Error: [MoveEvents Interface]
[05/04/2009 21:49:13] data/movements/scripts/monsters.luanStepIn
[05/04/2009 21:49:13] data/movements/scripts/monsters.lua:24: attempt to index local 'res' (a number value)
[05/04/2009 21:49:13] stack traceback:
[05/04/2009 21:49:13] data/movements/scripts/monsters.lua:24: in function <data/movements/scripts/monsters.lua:1>
---------------------------
What is wrong with this code?