Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Someone Else 37

Forum Addict
Feb 10, 2013
1,876
1,440
168
91 A word I just made up meaning "word with five syllables". Which it is.

Pentasyllabic is an adjective that is self-descriptive in same way.
 

Someone Else 37

Forum Addict
Feb 10, 2013
1,876
1,440
168
95 @lenscas Ehh, possibly... not really my thing, though. Too much structure.

That said, if I did make a character, I'd probably rip off Gideon or Ajani except give him a new name and possibly a new weapon and/or appearance. I'd do Jace or Ral, except J already took Jace's artwork, and you yourself basically took Ral's power set.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
95 I started work on the query builder.
helper.db:select("*")
helper.db:from("users")
local rows =helper.db:get()
local data = helper.db:result(rows)
local readableData={}
for key,value in pairs (data) do
table.insert(readableData,table.concat(value," "))
end
return readableData

2 things that I want to add but I am not sure if one is possible.
The first being function chaining, however I expect this to not work very well. Maybe if I make it so you give the next function? Or you are able to make a table for the order and arguments to the functions you want to execute?
The other being is that you can supply the result function with another function that will be executed in the foreach loop that gathers the data instead of table.insert() or something among those lines.

Because the result function is pretty much a for loop so currently there are 2 loops being executed when 1 could do.

But I think that making the where, join group, remove, insert and stuff like that is more important as well as making sure everything is automatically escaped but need to figure out how prepared statements exactly work with luaDBI (Another thing I need to do later on is add support for luaSQL. LuaDBI is better in my eyes due to prepared statements but hasn't had any development since 2 years or so now and is thus getting outdated :( )
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
95 today I learned about the unpack function. I just wish I didn't need it but okay, what gives it works.

Also, the query builder is getting some nice progress. (This is what happens when you let it make an sql syntax error which I did because I wanted to see the sql it was executing.)
Code:
Error
./lcCore/database.lua:62: There was an error while executing:
SELECT *
FROM users
(
WHERE id != ?
)
)
OR id = ?

Check the sql syntax.

Traceback
stack traceback:
[C]: in function 'assert'
./lcCore/database.lua:62: in function 'get'
./application/models/basicModel.lua:20: in function 'getMudData'
./application/controllers/test/path.lua:10: in function 'handler'
/usr/local/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
/usr/local/share/lua/5.1/lapis/application.lua:161: in function </usr/local/share/lua/5.1/lapis/application.lua:159>
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/lapis/application.lua:159: in function 'dispatch'
/usr/local/share/lua/5.1/lapis/nginx.lua:205: in function 'serve'
content_by_lua(nginx.conf.compiled:22):2: in function <content_by_lua(nginx.conf.compiled:22):1>
Every line is a separate function. I have lots of sql things to do still but I would say that this is progress :)
(Also, the "?" thing automatically getting filled in with the correct variable assuming unpack works correctly. It is in the string because of how luaDBI does the prepared statements. Which reminds me that I need to make a function that automatically converts "?" to "\?" or whatever it was to make sure luaDBI doesn't see it as a place that needs to be filled in. )