Team Spartan Cookies & Milk Forums
Possible dependency bug - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Possible dependency bug (/thread-2354.html)



Possible dependency bug - esitee - 02-07-2017

Hello everyone!

While working on my new mainframe, I've noticed a interesting (possible) bug with the dependency of 2 libs. I tried to include both of them via dependency directly in the server environement. Both libs basically included some tables with data. The strange part now was that I could use the contents of the first lib perfectly fine, but the second lib's tables weren't recognized at all (nil error). Both libs were located on the exact same path of my shared folder, with the same permissions set on them. Furthermore the paths and names were written perfectly fine, so everything was ok there.

Here's the example code I used at first:

--@dependency STEAM_0:1:68201847 lib/FirstLib.txt sv 
--@dependency STEAM_0:1:68201847 lib/SecondLib.txt sv

if SERVER then
print( TableFromFirstLib[1] ) --This would print entry one
print( TableFromSecondLib[1] ) --This would error the chip with the message that the table itself is nil
end

Anyhow, after Yuri thought it may be intentional, I tried a different version and it worked:


--@dependency STEAM_0:1:68201847 lib/FirstLib.txt sv 
--@dependency STEAM_0:1:68201847 lib/SecondLib.txt

if SERVER then
require( "lib/SecondLib.txt" )
print( TableFromFirstLib[1] )
print( TableFromSecondLib[1] ) --Now both printed out the correct String's with no error
end

I did check the sf-helper and the tutorial in case there would have been anything to clear this up, but there wasn't.

So is this a bug, was it intentional or did I just misunderstood how the whole dependency system works?


RE: Possible dependency bug - Person8880 - 02-07-2017

I can't reproduce this. When I use two different files from the shared area that both declare globals with --@dependency, they are both run and both globals are available.

If you can reduce this to the test case you've given in your post and get it to still fail (I'm assuming that's not the code you were really using), that would be helpful.


RE: Possible dependency bug - esitee - 02-07-2017

(02-07-2017, 05:46 PM)Person8880 Wrote: If you can reduce this to the test case you've given in your post and get it to still fail (I'm assuming that's not the code you were really using), that would be helpful.

I did reduce it to the test case before with the same result. I'll just leave the exact test code I used, when getting the error:

--@name Libtest
--@author Esitee
--@dependency STEAM_0:1:68201847 lib/Aschen-Lib.txt sv
--@dependency STEAM_0:1:68201847 lib/Permissions.txt sv

--[[
My permission lib is working fine and it will give out the access level perfectly, but the aschen-lib tables won't work.
]]

if SERVER then
print(Permissions[ents.owner()ConfusedteamID()]) --will print 5
print(L["universe"]) --chip errors saying L is nil, should give out a warp vector in chat
end

This throws the following error:
Code:
[SF - ERROR] SF:libtest.txt:10: attempt to index global 'L' (a nil value)

And here the used table excerpts of the libs. For the sake of simplicity, i'm only going to post one entry of the warp table:

Permission-Lib (functions and that stuff left out, but they work as well) :

Permissions = {} 
Permissions[ents.owner()ConfusedteamID()] = 5

Aschen-Lib:

L = {}  -- Warp Table
L["universe"] = Vector( 6793.40, -1623.81, -3709.46 )


As stated before, when I change things up, so that one file is later included with
Code:
require( "filepath" )
it works just normal..


RE: Possible dependency bug - Person8880 - 02-07-2017

I found the problem, it should be fixed when the servers next restart.


RE: Possible dependency bug - esitee - 02-07-2017

Thank you, Person!