Skip to content

loading compiled lua scripts #36

Description

@alexribeirodesa

I made this small code to load the file using the lua lib, with this you can open both raw and binary lua script.

luacppinterface.h:
// run a Lua script
std::string LoadScript(std::string script);

luacppinterface.cpp:
std::string Lua::LoadScript(std::string script)
{
if (luaL_loadfile(state.get(), script.c_str())) {
return LuaGetLastError(state.get());
}
lua_pcall(state.get(), 0, LUA_MULTRET, 0);

return "No errors";

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions