private static int ChangeHorse(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); Horse horse = (Horse)ToLua.CheckObject(L, 1, typeof(Horse)); int horseId = (int)LuaDLL.luaL_checknumber(L, 2); horse.ChangeHorse(horseId); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }