• Advertisement
Sign in to follow this  

Quick Lua noob question

This topic is 4667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

void KeyDown(unsigned char key) {
		lua_getglobal(pLuaState,"KeyDown");
		if(key==DIK_LEFT) {
			lua_pushstring(pLuaState,"left");
		}
		else if(key==DIK_RIGHT) {
			lua_pushstring(pLuaState,"right");
		}
		else
			lua_pushnil(pLuaState);

		if(lua_pcall(pLuaState,1,0,0)) {
			OutputDebugString(lua_tostring(pLuaState,-1));
			OutputDebugString("\n");
		}
		
	}

lua_pcall fails and the debug code prints out "attempt to call a nil value" How would I go about tracking down what causes this? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement