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.
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:
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?
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.
(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:
--[[
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()teamID()]) --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) :