Skip to content

Instantly share code, notes, and snippets.

@jeremyong
Last active January 2, 2016 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyong/8365448 to your computer and use it in GitHub Desktop.
Save jeremyong/8365448 to your computer and use it in GitHub Desktop.
First pass
#pragma once
namespace sel {
class State {
private:
lua_State *_l;
public:
State() : _l(nullptr) { _l = luaL_newstate(); }
State(const Luab &other) = delete;
State &operator=(const Luab &other) = delete;
State(State &&other) : _l(other._l) { other._l = nullptr; }
~State() { if (_l == nullptr) return; lua_close(_l); }
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment