Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. int lua_getfenv(lua_State *L) { // function or index as 1
  2.     //printType(lua_type(L, 1));
  3.     int idx = 0;
  4.     const char* nm;
  5.     while (true) {
  6.         idx++;
  7.         nm = lua_getupvalue(L, 1, idx);
  8.         //printf(nm ? nm : "NULL");
  9.         if (strcmp(nm ? nm : "", "_ENV")) {
  10.             //printf("returning ");
  11.             return 1;
  12.         }
  13.         if (nm==NULL) {
  14.             //printf("goofed ");
  15.             return 1;
  16.         }
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement