Forum

> > CS2D > Scripts > [LuaJIT] MySQL Example
Forums overviewCS2D overview Scripts overviewLog in to reply

English [LuaJIT] MySQL Example

No replies
To the start Previous 1 Next To the start

old [LuaJIT] MySQL Example

Marcell
Super User Off Offline

Quote
IMG:https://luapower.com/luapower.png


Hey guys,

You know guys, DC released the new version of CS2D, which supports LuaJIT. However there are some bugs, i got worked MySQL connection.

IMG:https://kephost.com/images/2015/06/22/desc.png


Simple connection for CS2D to MySQL Server via LuaJIT's SQL module. On the server start the script query version of the MySQL server, so connection works fine
I must say its works pretty fast, queries are like the lightning.

∗ Script written by Marcell ∗

∗ Credits to @user Starkkz: for asking DC to add LuaJIT and for helping ∗

Links:

LuaJIT: http://luajit.org
LuaPower: https://luapower.com/mysql

IMG:https://kephost.com/images/2015/06/22/exam.png


1
2
3
4
5
6
7
8
9
10
11
12
13
14
function version()

	local mysql = require'mysql'

	local conn = mysql.connect('localhost', 'root', 'football', 'mysql', 'utf8')

	local server_version = conn:server_info()
	local contype = conn:server_version()
	local host = conn:host_info() 
	print('©000255000Your MySQL Server version is: ' .. server_version)
	print('©000255000Your MySQL HOST: ' .. host)
end

version()

IMG:https://kephost.com/images/2015/06/22/proof.png


edited 1×, last 22.06.15 12:15:20 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview