Hi,
I've created a new table within CivBE and now what I am trying to do is retrieve whatever records are in the newly created table via Lua.
I have looked at various tutorials but I cannot seem to get it to work.
function Test ()
local db = sqlite("CivBEDebugDatabase.db", "r")
local query = [[
select name, email, phone from person
where name like :1;
]]
for name, email, phone in db:records(query, { 'a%' }) do
print(name, email, phone)
end
end
Now this is a simple tutorial code that I'm trying to get working so that I understand the basics. If I try and do a Test() - I get "Attempt to index a nil value"
I'm obviously missing something major here, can anyone assist or point me in the right direction? Thanks.
I've created a new table within CivBE and now what I am trying to do is retrieve whatever records are in the newly created table via Lua.
I have looked at various tutorials but I cannot seem to get it to work.
Spoiler :
function Test ()
local db = sqlite("CivBEDebugDatabase.db", "r")
local query = [[
select name, email, phone from person
where name like :1;
]]
for name, email, phone in db:records(query, { 'a%' }) do
print(name, email, phone)
end
end
Now this is a simple tutorial code that I'm trying to get working so that I understand the basics. If I try and do a Test() - I get "Attempt to index a nil value"
I'm obviously missing something major here, can anyone assist or point me in the right direction? Thanks.