Closed GreedyTactician closed 2 years ago
To access some functionality in lua, you need to load some libraries (math, debug, ...) For require you need package library. https://sol2.readthedocs.io/en/latest/api/state.html?highlight=open_libraries#members
Try lua.open_libraries();
to open all libraries or lua.open_libraries(sol::lib::base, sol::lib::package);
to open the libraries containing print and require
I assume you already open at least the base library as you do not have any errors about printing.
Thank you!
When I run
lua.script("print(require)");
in C++, I getnil
printed Why?