Stary2001

Untitled

Sep 14th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. lua= new Lua();
  2.  
  3. List<string> good=new List<string>();
  4. List<object> good_obj = new List<Object>();
  5.  
  6. lua.DoString("luanet=nil package.loaded.luanet=nil package.loaded.luanet=nil require=nil package.loadlib=nil");
  7.  
  8. good.Add("os.time");
  9. good.Add("math");
  10. good.Add("string");
  11.  
  12. foreach (string k in good)
  13. {
  14. Predicate<string> pred = new Predicate<string>(s => s == k); // lambda!
  15.  
  16. good_obj[good.FindIndex(pred)]=lua[k];
  17. }
  18.  
  19. foreach (DictionaryEntry ent in lua.GetTable("_G"))
  20. {
  21. lua[(string)ent.Key] = null;
  22. }
  23.  
  24. foreach (string k in good)
  25. {
  26. Predicate<string> pred = new Predicate<string>(s => s == k); // lambda!
  27. lua[k] = good_obj[good.FindIndex(pred)];
  28. }
  29. lua["string.dump"] = null;
Advertisement
Add Comment
Please, Sign In to add comment