Jump to content

Can I load a custom dll?


Recommended Posts

Basically I wanted to connect to a sqlite DB for logging and other stuff.

However the interpreter does not come with the luasql package and I can't seem to link the dll with the required drivers it in my mod...

From what I've read it should be possible (not necessarily simple), but I haven't been able to figure it out yet...
Is this possible?
 

Link to comment
Share on other sites

I do believe the modding environment forbids loading of dlls and other externally compiled third party libraries to protect the users from highly malicious content from happening in the workshop.

If you don't mind a bunch of "SimLuaProxy::QueryServer()" log messages in the server_log.txt file, then there is the web-based approach that you could have by setting up a middle man local website to handle the SQL queries/entries.

TheSim:QueryServer(
    URL,
    function(result, isSuccessful, http_code)
        if isSuccessful and http_code == 200
        then
            -- Use 'result' variable here, which contains the response from the server and is a string.
        end
    end,
    "GET"
)
TheSim:QueryServer(
    URL,
    function(result, isSuccessful, http_code)
        if isSuccessful and http_code == 200
        then
            -- Use 'result' variable here, which contains the response from the server and is a string.
        end
    end,
    "POST",
    DATA -- This is a string variable
)

--[[
Example DATA with JSON formatting:
DATA = json.encode(
    {
        reason = "Joined",
        userid = "KU_TOPPOT",
        time = 1234567890,
    }
)
]]--

 

Link to comment
Share on other sites

It actually makes sense...
Also, there is no package.cpath defined to load dll's. I tried defining a cpath for loading dll's and indeed got an error message:

[00:03:14]: error loading module 'sqlite3' from file 'C:\Users\fabio\workspace\walter\sqlite3.dll':
	DLL Loading blocked for - C:\Users\fabio\workspace\walter\sqlite3.dll

So that's definitely a no.
Well, the http server will have to do.

Thank you @CarlZalph

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...