Code: Select all
-- Initialize the duris database
db:create("duris", {stats={"ID", "Vnum", "TYPE", "SLOT", "NAME", "LOCATION", "STATS", "iLVL"}})
Code: Select all
local mydb = db:get_database("duris")
local res = db:fetch(mydb.stats,{db:eq(mydb.stats.LOCATION, zoneName), db:like(mydb.stats.NAME, itemName)})
display(res)
Outputs:
{
{
TYPE = "INSTRUMENT",
Vnum = "29480.00",
SLOT = "Attach",
ID = "3336",
NAME = "the horn of the dragonslayer",
LOCATION = "Harrow -The Gnome Village",
STATS = ""
}
}
Code: Select all
res[1].iLVL = itemValue
cecho("<DodgerBlue> Item Value set to: <khaki>" ..itemValue)
display(res)
Outputs:
Item Value set to: 1
{
{
iLVL = 1,
LOCATION = "Harrow -The Gnome Village",
NAME = "the horn of the dragonslayer",
SLOT = "Attach",
ID = "3336",
TYPE = "INSTRUMENT",
Vnum = "29480.00",
STATS = ""
}
}
Code: Select all
db:update(mydb.stats, res[1])
Outputs:
[ERROR:] object:<testvalue> function:<Trigger78>
<[string "-------------------------------------------..."]:1118: Can only update a table
with a _row_id>