of     2   
chevron_rightchevron_rightchevron_right

SDuke524
#59824271Monday, December 19, 2011 9:03 PM GMT

Link : http://www.roblox.com/--item?id=67508462 It currently has `USE`,`INSERT`, `SHOW`, `SELECT`, `CREATE`, `DELETE` and `UPDATE`. It also includes `_G.print_r()` and `_G.explode()`. How to use : ## _G.print_r() ## `_G.print_r()` will take an array and print it out in the output. Works just like print_r() in PHP.     local a={1,"r",{1,2,3}};          _G.print_r(a); Output : > [1] => 1 [2] => r [3] => array (  [1] => 1  [2] => 2  [3] => 3 ) ## _G.explode() ## `_G.explode()` will take a string and a pattern. Returns an array and will work just like explode() in PHP.     local str="hi,ter,qwerty,boi";          _G.print_r(_G.explode(str,',')); Output : > [1] => hi [2] => ter [3] => qwerty [4] => boi ## _G.sql_query() ## _G.sql_query() will take a string. Depending on the query, it will return either an array or void.     _G.sql_query("query here :P"); ## USE ## `USE` selects the database that will be used.     _G.sql_query("USE ​database_name"); ## CREATE ## `CREATE` is used to make new tables and databases To make a new database you would do :     _G.sql_query("CREATE database database_name"); and this will create a new database named "database_name" To make a new table you would do :     _G.sql_query("USE database_name");     _G.sql_query("CREATE table table_name (id NUMBER,name STRING,strange BOOLEAN)"); and this will create a table named table_name with the collumns id, name and strange. ## INSERT ## `INSERT INTO` will insert a new row into your table. You must identify the table, the collumns you're entering into, and the values being entered.     _G.sql_query("USE database_name");     _G.sql_query("INSERT INTO table_name (id,name,strange) VALUES(1,'SD',true)"); **NOTE** The values must line up with what you put in the first brackets, and it will error if you put in the wrong data type. ## UPDATE ## `UPDATE` will update a row in your database. You will use the keyword `WHERE` to identify which ones you want to edit. If you don't include `WHERE`, it'll update every row in the table.     _G.sql_query("USE database_name");     _G.sql_query("UPDATE table_name SET strange=false WHERE id=1"); or     _G.sql_query("UPDATE database_name.table_name SET strange=false WHERE id=1"); *( Thanks to popinman322 for helping me debug the conditionals )* You can only use one conditional as of right now. The comparison symbols that can be used are =,!=,>,= which should be self-explanatory to those of you reading this. ## DELETE ## `DELETE` will delete a row. You must use the keyword `WHERE` to identify which ones will be deleted. If you don't include `WHERE`, it'll delete every row in the table.     _G.sql_query("USE database_name");     _G.sql_query("DELETE FROM table_name WHERE id=1"); or     _G.sql_query("DELETE FROM database_name.table_name WHERE id=1"); ## SELECT ## This will return an array of the information in which you requested. First you will put `SELECT` and in between that and `FROM` will be the collumns you want it to return. If you want it to return all the collumns, just put a "*", if you want to return just a couple columns, seperate them by commas. Then after `FROM` comes the table name. Then the `WHERE` and conditional. Without `WHERE` it will return everything in the table.     local arg=_G.sql_query("SELECT * FROM table_name");     _G.print_r(arg); Output : > [1] => array ( [id] => 1 [name] => SD [strange] => false ) or     local arg=_G.sql_query("SELECT id,strange FROM database_name.table_name WHERE name='SD'");     _G.print_r(arg); Output : > [1] => array ( [id] => 1 [strange] => false ) ## SHOW ## Mostly for debugging, SHOW will print out information you ask for in the output.     _G.sql_query("SHOW databases"); will print out the names of all the databases in the output like so : > db1 db2 db3     _G.sql_query("SHOW tables FROM database_name"); will print out the names of all the tables in "database_name" like so : > table1 table2 table3     _G.sql_query("SHOW columns FROM database_name.table_name"); will show all the columns in table_name like so : [1] => array ( [id] => 1 [name] => SD [strange] => false ) Comments? Suggestions? Ideas? Don't comment on my grammar or anything, I'm tired.
TheNewScripter
#59824690Monday, December 19, 2011 9:09 PM GMT

A suggestion would be to add in manual global fixing so you don't have to have _G[function].     for index, value in next, _G do         getfenv()[index] = value     end And I just have a question... What would I use this for? Just wanted to know.
SDuke524
#59824941Monday, December 19, 2011 9:12 PM GMT

@TheNew If you wanna hack it like that, be my guest. Also it's used for anything SQL is used for. Database saving. You could use it to keep your leaderstats protected, you could use it to hold information for players that have left the game already, basically anything that requires data to be saved. If you used SQL or MySQL you would truly understand it a lot better.
TheNewScripter
#59824951Monday, December 19, 2011 9:13 PM GMT

Also, is a Database just like a Library that ROBLOX has? Or... something else... If it is something else, please explain.
TheNewScripter
#59825013Monday, December 19, 2011 9:13 PM GMT

Oh, I haven't used either of those... Sadly, I am only a RBX.lua and a [learning] Java programmer...
Profile
#59825124Monday, December 19, 2011 9:15 PM GMT

TheNewScripter, java is a waste of time, i hardly call anyone who uses it a 'programmer' learn C/C++ your better off there if you want to make GUI applications with it use QT framework.
TheNewScripter
#59825257Monday, December 19, 2011 9:17 PM GMT

Back on topic though... When I say a library that ROBLOX has, I meant a Pseudo-Library. Anyway, is it just a table?
myrkos
#59826271Monday, December 19, 2011 9:34 PM GMT

C/C++ isn't a language, Profile.
SDuke524
#59830773Monday, December 19, 2011 10:35 PM GMT

Ok... for the sake of keeping conversation going, people list ideas of things you could use this for.
Oysi
#59834640Monday, December 19, 2011 11:29 PM GMT

[ Content Deleted ]
SDuke524
#59856069Tuesday, December 20, 2011 5:00 AM GMT

Yeah, however when SORT BY is done, this will be a lot better.
GigsD4X
#59856942Tuesday, December 20, 2011 5:17 AM GMT

This is actually pretty cool, have you guys tested its efficiency? CALL IN THE JULIEN/OYSIs
GigsD4X
#59857016Tuesday, December 20, 2011 5:19 AM GMT

Oh and you should add the AND, OR, XOR, and LIMIT statements.
TheMyrco
#59864237Tuesday, December 20, 2011 1:19 PM GMT

>JULIEN/OYSIs MEH!? ~Myrco; Music lover, nederlands/dutch and a scripter
TooKawaiiForSenpai
#59865360Tuesday, December 20, 2011 2:05 PM GMT

What sorting algorithm are you going to use?
SDuke524
#59941902Wednesday, December 21, 2011 7:11 PM GMT

@ninja Whatever I make up when I get there.
JulienDethurens
#59975893Thursday, December 22, 2011 3:04 AM GMT

Can we see the source?
Legend26
#59976331Thursday, December 22, 2011 3:11 AM GMT

Did you even read the thread? The link is right at the top of the first post...
exspammer
#59976896Thursday, December 22, 2011 3:20 AM GMT

Do you know what is even more useful... LISP
SDuke524
#60046179Friday, December 23, 2011 4:28 AM GMT

So has any of the 5 people who have taken this done anything with this? If so I'd like to see it.
Legend26
#60046340Friday, December 23, 2011 4:31 AM GMT

I haven't really done anything. Personally, I can't fathom how all these web languages work in the first place and don't really like how SQL seems to work.
NVI
#60049088Friday, December 23, 2011 5:35 AM GMT

I'm late, but Profile is an idiot. Java is a widely used language. It's what Android runs off of, what enterprise-level servers typically use, and so much more. It could even feasibly overtake C/C++ in the next few years. Oh, and by the way, Qt is absolutely useless. Please stop spreading your crap, Profile.
myrkos
#60050797Friday, December 23, 2011 6:21 AM GMT

"Java is a widely used language. It's what Android runs off of, what enterprise-level servers typically use, and so much more. It could even feasibly overtake C/C++ in the next few years." No. It can't. They are totally different realms that barely overlap. "Oh, and by the way, Qt is absolutely useless." More like you've never had a look at it and thus your ignorance tells you that it's useless.
GigsD4X
#60051202Friday, December 23, 2011 6:34 AM GMT

I was editing the script and I was confused when you wrote "collumns" instead of "columns" instead of "rows" XD
LocalChum
#60051372Friday, December 23, 2011 6:39 AM GMT

Java sucks. Live with it.

    of     2   
chevron_rightchevron_rightchevron_right