Hi, I'm currently making something to bypass the lua limit for a friend (I told him his server is shit and if he needs to bypass it, he should remove the god damn trash) but guess not
Anyways, I wrote this and for some odd reason, it seems to work just fine, but when I actually RunStringEx the files, hl2.exe freezes completely. I dont think it's an infinite loop, so I honestly cant tell.
Help would be appreciate!
[url]https://github.com/zerothefallen/LuaLoader/blob/master/lua/autorun/server/lualoader.lua[/url] if you prefer this
[lua]// yay lua loader]
// created by request
// op
local ll = {}
print("Lua Loader loaded.")
print("Created by Zero The Fallen")
print(debug.getinfo(1).short_src)
if !ll.loaded then
ll.loaded = true
print()
// use the root directory. eg if you have an addon like
// addons/qac/lua/autorun/server
// Then put "addons/qac/lua/autorun/"
ll.directories = {"lua/autorun/server/"}
ll.filesLoaded = {}
ll.loadServer = function(lua)
if !lua then return end
if table.HasValue(ll.filesLoaded, lua) then return end
RunStringEx(file.Read(lua, "GAME"), lua)
print("How it would look: RunStringEx(file.Read(" .. lua .. ", GAME)," .. lua .. "\n")
table.insert(ll.filesLoaded, lua)
end
ll.loadClient = function(lua)
if !lua then return end
if table.HasValue(ll.filesLoaded, lua) then return end
AddCSLuaFile(lua)
print("How it would look: AddCSLuaFile(" .. lua .. ")".. "\n")
table.insert(ll.filesLoaded, lua)
end
ll.loadShared = function(lua)
ll.loadServer(lua)
ll.loadClient(lua)
end
ll.loadFiles = function()
for k, v in pairs(ll.directories) do
local path = v
local files, dirs = file.Find(v .. "*", "GAME")
// Shared
for k , v in pairs(files) do
ll.loadShared(path .. v)
//print("Loaded shared file:" .. path.. v.. "\n")
end
// Servers and Client)
for k, v in pairs(dirs) do
if v == "autorun" then
local _, newdirs = file.Find(path .. "autorun/*", "GAME")
path = path .. "autorun/"
//print(path)
for k, v in pairs(newdirs) do
if v == "client" then
client_path = path .. "client/"
//print("Client path is " .. client_path)
local current, useless = file.Find(client_path .. "*.lua" , "GAME")
//print("CLIENT FILES")
//PrintTable(current)
//print()
for k, v in pairs(current) do
local clientfile = client_path .. v
ll.loadClient(clientfile)
end
end
if v == "server" then
serv_path = path .. "server/"
//print("Server path is " .. serv_path)
local current, useless = file.Find(serv_path .. "*.lua" , "GAME")
//print("SERVER FILES")
//PrintTable(current)
//print()
for k, v in pairs(current) do
local servfile = serv_path .. v
ll.loadServer(servfile)
end
end
end
end
end
end
end
ll.loadFiles()
end[/lua]
[code]
local ll = {}
...
if !ll.loaded then
ll.loaded = true
...
end
[/code]
[QUOTE=Willox;47104252][code]
local ll = {}
...
if !ll.loaded then
ll.loaded = true
...
end
[/code][/QUOTE]
for some reason it was running twice, so i made sure if it's nil, it will only run. aka once.
lol
[editline]9th February 2015[/editline]
aka so it doesnt start loading itself non-stop.
[code]
local ll = {}
[/code]
step it up
(oh i thought you didn't understand)
[QUOTE=Willox;47104265][code]
local ll = {}
[/code]
step it up
(oh i thought you didn't understand)[/QUOTE]
im confused. i was just creating a table to store shit in
did i do something wrong lol.
Yeah your if statement is useless
oh. :^)
[editline]9th February 2015[/editline]
I had a
[lua]if table.HasValue(ll.filesLoaded, lua) then return end
table.insert(ll.filesLoaded, lua)[/lua]
shoved in as well, so im still unsure why it's freezing. am i causing an infinite loop or what. Its 1 am so I might not be thinking thoroughly.
I have a feelings its the fact i localized it.
This is a good idea. Sell it on ScriptFodder for $20.
Why would I go so low? its at least $75
pls halp
[b]l o c a l[/b] ll = {}
if(!ll.loaded) then
ll.loaded = true;
end
1. File runs
2. local table is created.
3. Table is empty so if statement results in false.
4. This causes the local table to get loaded set to true.
5. File gets loaded again. Now the old local table is out of scope, and there's a new local table.
6. Repeat 3-6 endlessly until we crash.
[editline]9th February 2015[/editline]
I know this is sort of late but w/e
thank you for the help. on top of the local issue, which, like I stated before, twas 2 am. didnt get waht you were pointing out. I managed to fix it and it's all working now.
[url]https://github.com/zerothefallen/LuaLoader/blob/master/lua/autorun/server/lualoader.lua[/url] final working copy. least' i havent seen any issues
Sorry, you need to Log In to post a reply to this thread.