Skip to content

Instantly share code, notes, and snippets.

@take-cheeze
Created February 22, 2013 06:04
Show Gist options
  • Select an option

  • Save take-cheeze/5011094 to your computer and use it in GitHub Desktop.

Select an option

Save take-cheeze/5011094 to your computer and use it in GitHub Desktop.
diff --git a/src/platform/lua_bot.cpp b/src/platform/lua_bot.cpp
index a927e9d..5660d9e 100644
--- a/src/platform/lua_bot.cpp
+++ b/src/platform/lua_bot.cpp
@@ -62,7 +62,7 @@ void LuaBot::register_vm(lua_State* const L) {
LuaBot::LuaBot(std::string const& script)
: script_(script), executer_(NULL)
{
- vm_.reset(lua_open(), &lua_close);
+ vm_.reset(luaL_newstate(), &lua_close);
assert(vm_);
lua_State* const L = vm_.get();
@@ -96,7 +96,11 @@ void LuaBot::resume() {
assert(L);
assert(lua_type(L, -1) == LUA_TTHREAD);
+#if LUA_VERSION_NUM >= 502
+ switch(lua_resume(executer_, L, 0)) {
+#else
switch(lua_resume(executer_, 0)) {
+#endif
case 0: // LUA_OK
Output::Debug("Script ended. Quiting");
finish();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment