merlin11188

Packets

Jun 23rd, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. TableOfCodes={}
  2. _G.create=function(Name, Table)
  3.     TableOfCodes[Name]={}
  4.     for i,v in pairs(Table) do
  5.             TableOfCodes[Name][i]=v
  6.     end
  7. end
  8.  
  9. _G.include=function(Name)
  10.     local Environment=getfenv(2)
  11.     if not TableOfCodes[Name] then error("No packet called '"..Name.."'.") return false end
  12.     for i,v in pairs(TableOfCodes[Name]) do
  13.         Environment[i]=v
  14.     end
  15.     setfenv(2, Environment)
  16. end
  17.  
  18. _G.create("Test", {Factorial=function (x)
  19.     y=1
  20.     for i=x,1,-1 do
  21.         y=y*i
  22.     end
  23.     return y
  24. end})
Advertisement
Add Comment
Please, Sign In to add comment