Reputation: 55
I'm working on a game modification. There is the possibility to write addons in lua code. Since it's an older game, it's lua 5.0.2. I need some more powerful functions that I cannot do in lua, so I'd like to write those things in c++, compile them to a dll and import those functions from lua.
I'm using the latest VS community version for c++ development. I haven't found the 5.0.2 source, so I build lua 5.3.5 from source with VS.
Now, that I load the dll using require
I got this error
error loading package `data\_lvl_pc\REMASTER\remaster_IO.dll' (data\_lvl_pc\REMASTER\remaster_IO.dll:1: `=' expected near `')
The dll is very simple, to test the dll loading
#include "pch.h"
#include <lua.h>
int luaopen_remaster_IO(lua_State* L) {
Beep(200, 200);
}
I'm not sure if the problem is simply the fact that the dll is build using 5.3.5 source, while the game runs on 5.0.2, or if I'm just doing something wrong in my dll code.
Thanks for your help :D
Upvotes: 1
Views: 182
Reputation: 473447
Your DLL built against Lua 5.3 will not do the correct thing when loaded by an application that uses Lua 5.0. In order for an application and a DLL to work together with Lua, they must both be talking to the same Lua DLL implementation. Since the application uses 5.0, that's the DLL it will load (assuming it uses Lua as a DLL at all) and interact with. So your plugin needs to be built against the same DLL as the application.
Upvotes: 2