Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] luasql support - mysql storage of user data #177

Open
feardevilz opened this issue Sep 9, 2016 · 9 comments
Open

[feature] luasql support - mysql storage of user data #177

feardevilz opened this issue Sep 9, 2016 · 9 comments

Comments

@feardevilz
Copy link

Hi,
I'm looking to see if you can add luasql storage support with mysql so core sqlite data can be stored into mysql for things such as bans, ranks and whitelist. The ranks functions are important as I use PermissionsEX now on other servers. It would be nice if ranks could follow the same sql format as its counter part in bucket.

PEX look-a-like: https://www.spigotmc.org/resources/powerfulperms-20-off.8143/

@madmaxoft
Copy link
Member

Since Cuberite is compatible with LuaRocks, you can actually use any locally installed LuaRocks library, such as luasql, in your plugins. However, that makes the plugin dependent on that library and you should at least provide basic error-checking whether the library is available, and instructions for users on how to make it work on their platform.

Of course it would be nicer to have some SQL API it built-in directly in Cuberite, but that is somewhat unlikely in the nearest future.

@NiLSPACE
Copy link
Member

NiLSPACE commented Sep 9, 2016

As long as the Windows version uses its own compiled version of Lua we can't really use LuaRocks.

@madmaxoft
Copy link
Member

What? I've been using LuaRocks on windows for ages.

@madmaxoft
Copy link
Member

After all, LuaRocks is the reason we have two Lua DLLs on windows - the real one and the proxy one.

@NiLSPACE
Copy link
Member

NiLSPACE commented Sep 9, 2016

Oh, I didn't know that. I did try to use libraries from my Lua path, but it didn't work. I'll try again later today/tomorrow as it was a long time ago since I tried that.

@NiLSPACE
Copy link
Member

I've tried it, but I get this error:

[14:27:21] Line :1: module 'zip' not found:-58:\Projects\cuberite 2016-08-23\Server\lua\zip.lua'
no file 'D:-58:\Projects\cuberite 2016-08-23\Server\zip.lua'
no file 'D:-58:\Program Files (x86)\Lua\5.1\lua\zip.luac'
no file 'Plugins/Executor/zip.lua'
no file '.\zip.dll'
no file 'D:-58:\Projects\cuberite 2016-08-23\Server\loadall.dll'
no file 'Plugins/Executor\zip.dll'

Even though it works fine in the standalone version of Lua.

@madmaxoft
Copy link
Member

madmaxoft commented Sep 10, 2016

That would be because Cuberite doesn't use the LUA_PATH and LUA_CPATH environment variables, so it doesn't have the LuaRocks path set properly. Just to test it out, try adding the path manually to package.path and package.cpath Lua globals before requiring the module.

@NiLSPACE
Copy link
Member

Yes, after that it works. Is there a way to change the path and cpath automatically? Otherwise we'd first have to check if the operation system is Linux or Windows before adding the paths.

@yangm97
Copy link

yangm97 commented Nov 7, 2016

Thumbs up. A centralized SQL API could provide be very useful. Maybe in a such way one can switch between sqlite, mysql (cassandra? nosql?) and other db drivers without the plugins even knowing.

Basically, the plugin could choose between flatfile storage (already implemented) and the centralized SQL API cuberite could provide. The user would then setup the storage driver on cuberite itself, allowing the plugins to transparently use any storage driver and server the user so chooses.

This could end up being more complex than it needs to, but I think a centralized storage solution with swappable storage drivers would be the best solution for plugin developers and users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants