Skip to content

Instantly share code, notes, and snippets.

@beakr
Created December 16, 2013 05:13
Show Gist options
  • Save beakr/7982613 to your computer and use it in GitHub Desktop.
Save beakr/7982613 to your computer and use it in GitHub Desktop.
// Load stdlibs onto lua interpreter instance.
luaL_openlibs(this->L);
int s = luaL_dofile(this->L, file.c_str());
if (s == 0)
{
// Execute the script.
s = lua_pcall(L, 0, LUA_MULTRET, 0);
}
// Report errors.
if (s != 0)
{
cerr << "!! " << lua_tostring(this->L, -1) << endl;
lua_pop(this->L, 1);
}
lua_close(this->L);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment