Advertisement
Eliaseeg

FlattenFunction

Apr 10th, 2015
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. -- Sustituye puntos por "_" por E.g: table.insert -> table_insert
  2. do
  3.     function flattenFunctionTree(tree, path)
  4.         for name, value in pairs(tree) do
  5.             if type(value) == "table" then
  6.                 flattenFunctionTree(value, path .. name .. "_")
  7.             elseif type(value) == "function" then
  8.                 _G[path .. name] = value
  9.             end
  10.         end
  11.     end
  12.    
  13.     local temp = {}
  14.     for name, value in pairs(_G) do
  15.         if value ~= _G then
  16.             temp[name] = value
  17.         end
  18.     end
  19.     flattenFunctionTree(temp, "")
  20. end
  21.  
  22. local myTable = {"Ale es muy"}
  23. table_insert(myTable, "juapo")
  24. print(table_concat(myTable))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement