• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Getfunc.lua for 1.0 help

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
43
The error that comes when I run server to get function txt file
Lua Script Error: [Test Interface]
data/talkactions/scripts/getfunc.lua
data/talkactions/scripts/getfunc.lua:39: attempt to call field 'explode' (a nil
value)
stack traceback:
[C]: in function 'explode'
data/talkactions/scripts/getfunc.lua:39: in function 'getLuaFunctions'
data/talkactions/scripts/getfunc.lua:41: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/getfunc.lua

The script
Code:
function getLuaFunctions()-- by Mock    
local str = ""     for f,k in pairs(_G) do        
if type(k) == 'function' then            
str = str..f..','        
elseif type(k) == 'table' then            
for d,o in pairs(k) do                
if type(o) == 'function' then                    
if f ~= '_G' and d ~= "_G" and f ~= 'package' then                        
str = str..f.."."..d..','                    
end                
elseif type(o) == 'table' then                    
for m,n in pairs(o) do                        
if type(n) == 'function' then                            
if d == "_M" and m ~= "_M" and f ~= "_G" and f ~= 'package' then                                
str = str..f.."."..m..","                            
elseif f ~= '_G' and m ~= "_G" and d ~= "_G" and f ~= 'package' then                                
str = str..f.."."..d..'.'..m..','                            
end                        
elseif type(n) == 'table' then                            
for x,p in pairs(n) do                                
if type(p) == 'function' then                                    
if m == "_M" and d ~= "_M" and f ~= "_G" and f ~= 'package' then                                    
    str = str..f.."."..d..'.'..x..','                                    
    elseif m == "_M" and d == "_M" and f ~= "_G" and f ~= 'package' then                                    
    str = str..f.."."..x..','                                    
    elseif m ~= "_M" and d == "_M" and f ~= "_G" and f ~= 'package' then                                        
    str = str..f..'.'..m..'.'..x..','                                    
    elseif f ~= '_G' and m ~= "_G" and d ~= "_G" and f ~= 'package' then                                        
    str = str..f.."."..d..'.'..m..'.'..x..','                                    
    end                                
    end                            
    end                        
    end                    
    end                
    end            
    end        
    end    
    end    
    return string.explode(str,',')
    end
    local k = getLuaFunctions() --- Create file content your server function list
    local file__ = io.open('Your Server Function List.txt','w') table.sort(k)
    for i=1,#k do if k[i] ~= "" then
    file__:write((i-1)..' - '..k[i]..'\n')
    end
    end file__:close()
 
Code:
string.trim = function (str)
     return str:gsub("^%s*(.-)%s*$", "%1")
end

string.explode = function (str, sep, limit)
     if type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0) then
         return {}
     end

     local i, pos, tmp, t = 0, 1, "", {}
     for s, e in function() return string.find(str, sep, pos) end do
         tmp = str:sub(pos, s - 1):trim()
         table.insert(t, tmp)
         pos = e + 1

         i = i + 1
         if limit ~= nil and i == limit then
             break
         end
     end

     tmp = str:sub(pos):trim()
     table.insert(t, tmp)
     return t
end
 
That's the missing function for that error, it's not a part of the script/function you posted, it's used in more scripts.
 
Back
Top