   Resuming a Lua coroutine
  I'm currently trying to resume a lua coroutine once per frame in my game engine, but I can't seem to get the call setup right. According to the lua stack dump, I'm getting a table when I should be getting a thread object after loading the global for "co".Minimal script example:function levelScript()Dedant.addFireAnt(0.0, 1.0)Dedant.addFireAnt(1.0, 1.0)coroutine.yield()endco = coroutine.create(levelScript)And the c that resumes the coroutine (I've already verified that the script file is loaded correctly).lua_getglobal(luaState, "coroutine");lua_pushstring(luaState, "resume");lua_gettable(luaState, -2); // gets the actual function for coroutine.resumelua_remove(luaState, 1);lua_getglobal(luaState, "co");if(lua_pcall(luaState, 1, 0, 0) != 0){    printf("[LEVEL SCRIPT ERROR] %s\n", lua_tostring(luaState, -1));    luaStackDump(luaState);}And this is what I get from the stack dump:[LEVEL SCRIPT ERROR] bad argument #1 to '?' (coroutine expected)function: (null) <-- expectedtable: (null)    <-- why is this not a thread??If anybody could point out what I'm doing wrong, it would be hugely appreciated.   
  figured it out, I was calling luaL_loadfile instead of luaL_dofile. So while the script chunk was loaded, it was never executed and so my coroutine was never defined.   ;What makes the Left 4 Dead series' gameplay design work so well for players? This comprehensive design analysis analysis takes developer commentary and matches it against the SRK Framework, a tool for categorizing cognitive behavior in interactive media.  View the full article