Jump to content

sqlite3 in lua problem


dennis
 Share

Recommended Posts

Hey guys,

 

I'm using sqlite3 for my game now but I have some small problems with it.

as I'm coding:

 

require("Scripts/constants/collision_const")
require("Scripts/constants/engine_const")
require("Scripts/constants/keycodes")
require("Scripts/LinkedList")
require("Scripts/filesystem")
require("Scripts/math/math")
require("scripts/classes/bullet")
require("Scripts/hooks")
require("Scripts/spline")


RegisterAbstractPath("")

package.loadlib("lsqlite3.dll", "luaopen_lsqlite3")()
local db = sqlite3.open('game.s3db')

Graphics(800, 600)
fw = CreateFramework()


for row in db:nrows("SELECT * FROM graphx") do
bloom = SetBloom(row.Bloom)
end

 

why doesn't this work?

when I open up my script editor, and want to use this value inside it it returns: no such table: graphx

and when I use this and open up "engine.exe" it doesn't show up any error but still doesn't work. why?

 

and is there any explanation how to use this inside LE2?

 

I hope someone can help with this.

 

Cheers

Link to comment
Share on other sites

Are you using Rick's sql package?

http://www.leadwerks...te-for-les-lua/

I have successfully used it.

 

Have you created the table? http://www.w3schools...reate_table.asp

 

That problem is fixed now but now the main problem which is I can't read the data from that database and use that tp set the bloom for example which was my actual problem.

 

01.jpg

 

 

And

 

02.jpg

 

Last one to actually show that it doesn't show the bloom

 

03.jpg

Link to comment
Share on other sites

I've never used SQLite before but generally in SQL syntax you would reference the field by the table name not the row as you appear to be doing when passing the parameter. I'm assuming that row just increments the table cursor:

 

So you might try replacing row.Bloom with graphx.Bloom

 

[EDIT] I just looked at Ricks example and he does seem to reference the row object so perhaps row is a container object that acts as a temp storage object for the rows returned from the SQL statement, in which case your original syntax seems ok!

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

I've never used SQLite before but generally in SQL syntax you would reference the field by the table name not the row as you appear to be doing when passing the parameter. I'm assuming that row just increments the table cursor:

 

So you might try replacing row.Bloom with graphx.Bloom

 

[EDIT] I just looked at Ricks example and he does seem to reference the row object so perhaps row is a container object that acts as a temp storage object for the rows returned from the SQL statement, in which case your original syntax seems ok!

 

Thanks for the help I appreciate that :D but I found the problem, it was an real pain in the ***. but now I'm thinking off I'm stupid lol!

 

I forgot to add: camera = fw.main.camera

that line just helped perfectly ;) I mentioned it at the moment when I realized that an camera is needed to give graphical feedback.

 

Thanks guys!

Link to comment
Share on other sites

Unless you were using the variable 'camera' somewhere else (as it wasn't shown in the code above), then adding that 'camera=fw.main.camera' would make no difference. Framework automatically creates cameras for all three worlds and does not require you to assign them to another variable for it to work.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...