• Populating a sql database with a lua table
    5 replies, posted
Not sure if anyone has done this before but here's something I came up with today. [code] local Attributes = { "Strength", "Intelligence", "Dexterity", "Stamina" } //setup attributes sql.Query("CREATE TABLE IF NOT EXISTS AndrewRPG_Attributes('steam' TEXT NOT NULL, '" .. table.concat(Attributes, "' INTEGER NOT NULL, '") .. "' INTEGER NOT NULL, PRIMARY KEY('steam'));") //table Holding Atrribute Levels [/code] Basically you can put whatever you want into the lua table and when the query is run it will populate the sql database, every once in awhile i come up with something useful i like to think =P Andrew (enjia2000 on steam)
You haven't even connected to a db.
He does not need to connect. Why are all users of facepunch so slow? [b][i]THERE IS SQLite MODULE IN GMOD![/i][/b] You DO NOT need to connect anywhere. You just do queries to endine that stores database in local file.
[url]http://wiki.garrysmod.com/?title=Data_Storage[/url]
Look at my tutorial ;) [url]http://www.facepunch.com/showthread.php?t=777892[/url]
[QUOTE=quincy18;16241489]Look at my tutorial ;) [url]http://www.facepunch.com/showthread.php?t=777892[/url][/QUOTE] You're tutorial says nothing about storing dynamically formatted tables.
Sorry, you need to Log In to post a reply to this thread.