Gordo Posted July 8, 2017 Share Posted July 8, 2017 I'm attempting to make lua file system work with Avorion's lua. Now, by default require("module") can load lua modules. Using the following lua: local lfs = require("lfs") I compiled lua file system using Mingw-w64 4.9.2 using the following commands: gcc -c -Wall -fpic lfs.c -IC:/lua/include gcc -shared -o lfs.dll lfs.o -LC:/lua/ -llua52 Which produced the lfs.dll file. Which is usable in normal lua52 and I've tested that, it loads fine. I double checked what version of lua you're using in your engine and it reported lua52. So then I did a simple test and used require("lfs") the module is found and the server crashes. it then spits out this error 2017-07-08 03-29-02| Attempting to load luafilesystem 2017-07-08 03-29-02| Error: EXCEPTION_ACCESS_VIOLATION 2017-07-08 03-29-02| [1] lua_close 1688275260 2017-07-08 03-29-02| [2] lua_setglobal 1688216929 2017-07-08 03-29-02| [3] luaopen_lfs 1820600884 2017-07-08 03-29-02| [4] ?? 8428541 2017-07-08 03-29-02| [5] ?? 8429975 2017-07-08 03-29-02| [6] ?? 8406099 2017-07-08 03-29-02| [7] ?? 8453615 2017-07-08 03-29-02| [8] ?? 8428541 2017-07-08 03-29-02| [9] ?? 8511810 2017-07-08 03-29-02| [10] ?? 8429987 2017-07-08 03-29-02| [11] ?? 8406099 2017-07-08 03-29-02| [12] ?? 8453615 2017-07-08 03-29-02| [13] ?? 8428541 2017-07-08 03-29-02| [14] ?? 8511810 2017-07-08 03-29-02| [15] ?? 8429987 2017-07-08 03-29-02| [16] ?? 8425454 2017-07-08 03-29-02| [17] ?? 8430935 2017-07-08 03-29-02| [18] ?? 8406280 2017-07-08 03-29-02| [19] ?? 7578548 2017-07-08 03-29-02| [20] ?? 7579960 2017-07-08 03-29-02| [21] ?? 4383927 2017-07-08 03-29-02| [22] ?? 4237801 2017-07-08 03-29-02| [23] ?? 4931768 2017-07-08 03-29-02| [24] ?? 6440048 2017-07-08 03-29-02| [25] ?? 4860090 2017-07-08 03-29-02| [26] ?? 4864676 2017-07-08 03-29-02| [27] ?? 4223143 2017-07-08 03-29-02| [28] ?? 4242288 2017-07-08 03-29-02| [29] ?? 4244496 2017-07-08 03-29-02| [30] ?? 4209063 2017-07-08 03-29-02| [31] ?? 11199471 2017-07-08 03-29-02| [32] ?? 4199416 2017-07-08 03-29-02| [33] ?? 4199707 2017-07-08 03-29-02| [34] BaseThreadInitThunk 140716112422772 So then I changed the load library code in the DLL and commented out the default library functionality to make sure the DLL was loading, and it was, the engine stopped crashing. LFS_EXPORT int luaopen_lfs (lua_State *L) { //dir_create_meta (L); /*lock_create_meta (L);*/ //luaL_newlib (L, fslib); //lua_pushvalue(L, -1); //lua_setglobal(L, LFS_LIBNAME); //set_info (L); return 1; } Then i tested a basic example from the lua c api wiki and the same crash happened. static int l_sin (lua_State *L) { double d = luaL_checknumber(L, 1); lua_pushnumber(L, sin(d)); return 1; /* number of results */ } LFS_EXPORT int luaopen_lfs (lua_State *L) { lua_pushcfunction(L, l_sin); lua_setglobal(L, "mysin"); //dir_create_meta (L); /*lock_create_meta (L);*/ //luaL_newlib (L, fslib); //lua_pushvalue(L, -1); //lua_setglobal(L, LFS_LIBNAME); //set_info (L); return 1; } Can you please fix this as it's not fun being unable to use these modules? LuaFileSystem is not really the main one I wanted to test but it was the smallest. (it's a 2 file library) https://keplerproject.github.io/luafilesystem/ Link to comment Share on other sites More sharing options...
Dirtyredz Posted July 8, 2017 Share Posted July 8, 2017 This would be great, as there are many lua modules that modders can take advantage of. Link to comment Share on other sites More sharing options...
Gordo Posted July 11, 2017 Author Share Posted July 11, 2017 Any updates on this, I would appreciate any feedback Link to comment Share on other sites More sharing options...
Devious Posted July 25, 2017 Share Posted July 25, 2017 bump Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now