I'm currently trying to implement LUA into my CPP program however I am having the following issue: I have a library in lua lets say lib.lua that I'd like to be ran into runtime so that other lua scripts can access it however I'm having issues with that here's my code:
/* initialize Lua */
L = luaL_newstate();
/* load Lua base libraries */
luaL_openlibs(L);
/* add my path to package.path */
luaL_dostring(L, "package.path = 'D://Game.Helper/Lua/libs/?.lua;'..package.path ");
/* require my the library */
luaL_dostring(L, "_G class = require 'middleclass'");
^^^ THIS IS CURRENTLY THE CODE NOT WORKING ^^^
/* load the script */
luaL_loadfile(L, "d://Game.Helper/Lua/scripts/test.lua");
lua_call(L, 0, 0);
// clean it up
lua_close(L);
the script is loading properly however if I don't require my library in the script itself it will return a nil value for it
Any help is greatly appreciated, thank you!