text: #include "ldef.h"
  
  #ifndef luaL_checkversion
  
  void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup)
  {
      luaL_checkversion(L);
      luaL_checkstack(L, nup, "too many upvalues");
      for (; l->name != NULL; l++) {  /* fill the table with given functions */
          int i;
          for (i = 0; i < nup; i++)  /* copy upvalues to the top */
              lua_pushvalue(L, -nup);
          lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */
          lua_setfield(L, -(nup + 2), l->name);
      }
      lua_pop(L, nup);  /* remove upvalues */
  }
  
  #endif
  
  