• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved its working, but it still makes me confused.

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,454
Solutions
1
Reaction score
627
Location
Estonia
When I start up server and It starts loading global scripts it always does seem to do everything twice.
Because the prints happen twice.
But when I generate table for example. It doesn't execute the script twice, only prints twice.

All is still working, but whats up with that behavior?
 
You are being too ambiguous.
How exactly is it "printing" twice and not "executing" the script twice? What calls the print function..?
Also what do you define as "global" scripts (just regular ones?)
What does "generate table" stand for?

You should consider sitting and explaining with some more depth!
 
You are being too ambiguous.
How exactly is it "printing" twice and not "executing" the script twice? What calls the print function..?
Also what do you define as "global" scripts (just regular ones?)
What does "generate table" stand for?

You should consider sitting and explaining with some more depth!
for example:
Code:
local conditions = {
    SLOW = {},
}

for conditionType, subID in pairs(SUB.slow) do
    if tostring(conditionType):match("s_") then
        for x=0, 20 do
           table.insert(conditions.SLOW, subID+x)
        end
    else table.insert(conditions.SLOW, subID)
    end
end
for x=1, #conditions.SLOW do
print(conditions.SLOW[x])
end


it loops trough the table twice on server startUp.
but if i test the table in game afterwards, It prints the table once (that means, and all is good)
This means it didn't insert too many values, even though it seems like it ran trough script twice on startUp.

And with global script i mean.. outside the functions.
 
Okay so this happens only on server startUp.
Try printing something on startUp to see if the function is actually being executed twice or there is a different problem.

EDIT: Considering you've done this already (I'm sure you had?) then it may be time to either look into a programming issue or tracking down something else that calls that function yet again.
 
Okay so this happens only on server startUp.
Try printing something on startUp to see if the function is actually being executed twice or there is a different problem.

EDIT: Considering you've done this already (I'm sure you had?) then it may be time to either look into a programming issue or tracking down something else that calls that function yet again.
Figured it out.
Script resets and re-executes each time script is registered.

Had to pull my table generating loop to actual global.lua
 
Back
Top