Lua & additional libraries
#1
I am working on plugin that requires cloud storage.

I am trying to use socket.http to store general login/logout info. However, I get the following:
Code:
[15:35:21] LUA: Plugins/Metaverse/hooks.lua:15: module 'socket.http' not found:
        no field package.preload['socket.http']
        no file './socket/http.lua'
        no file '/usr/local/share/lua/5.1/socket/http.lua'
        no file '/usr/local/share/lua/5.1/socket/http/init.lua'
        no file '/usr/local/lib/lua/5.1/socket/http.lua'
        no file '/usr/local/lib/lua/5.1/socket/http/init.lua'
        no file 'Plugins/Metaverse/socket/http.lua'
        no file './socket/http.so'
        no file '/usr/local/lib/lua/5.1/socket/http.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file 'Plugins/Metaverse/socket/http.so'
        no file './socket.so'
        no file '/usr/local/lib/lua/5.1/socket.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file 'Plugins/Metaverse/socket.so'
[15:35:21] Stack trace:
[15:35:21]   [C](-1): require
[15:35:21]   Plugins/Metaverse/hooks.lua(15): (no name)
[15:35:21] Stack trace end
[15:35:21] Error in plugin Metaverse calling function <callback>()

I have no problems using socket.http in other Lua scripts on the same machine.
Reply
Thanks given by:
#2
Before you go any further, let me just remind you that using LuaSocket is a bad idea. It uses blocking socket calls, which means the server won't be able to continue until a network event occurs; this means that the server's world tick threads will stall within your plugin, as well as other threads. Although it is possible to use LuaSocket in non-blocking mode, I'm not sure if the http library supports that and it becomes a nightmare to program.

The other Lua scripts on the same machine, do they use Lua 5.1 or Lua 5.2? We use Lua 5.1 in MCServer, so any libraries installed for Lua 5.2 might be incompatible (see the "5.1" in the listed paths). I did manage to install LuaSocket via LuaRocks on my virtualboxed Ubuntu and it worked alright with MCS, so I suppose there's some hidden misconfiguration that we need to find out about.
Reply
Thanks given by:
#3
Is it possible to update the lua lib in the server to version 5.2?Confusedhy:
Reply
Thanks given by:
#4
Is there any specific need for that? Of course it should be possible, but it would break some of the plugins and possibly debugger IDEs (I'm not sure if Decoda supports Lua 5.2 already). Worst case scenario - the update breaks ToLua. That would be quite a disaster.
Reply
Thanks given by:
#5
Lua 5.3 is already released, so if we would update then why not immediately update to 5.3?

Or maybe even LuaJit?
Reply
Thanks given by:
#6
LuaJit would be a better update. If we're going to have to patch things, we might as well go for the option that gives significant performance improvement.
Reply
Thanks given by: tonibm19 , Seadragon91




Users browsing this thread: 4 Guest(s)