Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define what to find, remove the find table to find all
- local find = {}
- find.SpellSchoolMask = true
- -- utility
- local function WriteFile(path, str)
- local f = assert(io.open(path, "w"))
- f:write(str)
- f:close()
- end
- local function OpenFile(path)
- local f = assert(io.open(path, "r"))
- local str = f:read("*all")
- f:close()
- return str
- end
- local function scandir(path, files)
- local f = io.popen('dir "'..path..'" /b')
- if (not f) then return files end
- for name in f:lines() do
- if (name:find("%.")) then
- if (name:find("%.h$")) then
- table.insert(files, path.."/"..name)
- end
- else
- scandir(path.."/"..name, files)
- end
- end
- f:close()
- return files
- end
- -- Path to source
- local Files = scandir("E:/Cores/Eluna/trin_wotlk/source/src", {})
- local enums = {}
- for k,v in ipairs(Files) do
- for code, name in OpenFile(v):gmatch("(enum%s+([%w_]+)[%s\n]+%b{})") do
- if (not find or find[name]) then
- table.insert(enums, code)
- end
- end
- end
- -- Output file path
- WriteFile("enumss.lua", table.concat(enums, "\n\n"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement