Team Spartan Cookies & Milk Forums
[Help] Include/Requiring - 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: [Help] Include/Requiring (/thread-1289.html)

Pages: 1 2


RE: [Help] Include/Requiring - SuperPlayer - 22-09-2015

Well here I am again. The thing i do for requiring works. Atleast for me. The problem is no one else can see anything on my screen.
This is the code i am using for including requiring in my lib:

--@name StarOSLib_Main
--@author SuperPlayer
--@include lib/gui/GUILib_Main.txt
--@includedir lib/staros/modules/client
--@includedir lib/staros/modules/server
--@updater STEAM_0:0:74694146

StarOS = { }
StarOS.LoadedFiles = { }
StarOS.Started = false
StarOS.FilesLoaded = false
StarOS.ShowStartMenu = false
function StarOS.Boot()
StarOS.BootStatus = "Initializing..."

if CLIENT then
require("lib/gui/GUILib_Main.txt")
table.insert(StarOS.LoadedFiles,"lib/gui/GUILib_Main.txt")
ClientModules = getScripts()
for i = 1, #ClientModules do
table.insert(StarOS.LoadedFiles,ClientModules[i])
require(ClientModules[i])
end
end


if SERVER then
ServerModules = getScripts()
for i = 1, #ServerModules do
table.insert(StarOS.LoadedFiles,ServerModules[i])
require(ServerModules[i])
end
--StarOS.LoadSettings()
end
StarOS.FilesLoaded = true
StarOS.BootStatus = "Loading Settings..."
StarOS.LoadSettings()

end

StarOS.Boot()

And then this is what I am using in my screen:

--@require lib/staros/StarOSLib_Main.txt

Does anyone has an idea why just i can see stuff?
Thank you in advance!


RE: [Help] Include/Requiring - TheOneAndOnlyTee - 22-09-2015

Is it possible that --@includedir ...modules/client isn't working like --@requirecl ... , the client might not have the modules to draw with hence nothing drawing


RE: [Help] Include/Requiring - SuperPlayer - 22-09-2015

Hmm. Could work gonna try that out. Thank you.
But one problem: How do i requirecl a whole folder? Because i just can include one file with it if i am not mistaken?


RE: [Help] Include/Requiring - TheOneAndOnlyTee - 23-09-2015

No clue, if there's not many it shouldn't matter


RE: [Help] Include/Requiring - Person8880 - 23-09-2015

You're again mis-understanding how getScripts() works.

-- This snippet loads all script files.
local Scripts = getScripts()
for FilePath, CompiledScript in pairs( Scripts ) do
-- If you want to only load those from a certain folder, check FilePath starts with the folder path.
-- Calling the CompiledScript function loads the script file.
CompiledScript()
end

I'll add this example to the in-game documentation too.


RE: [Help] Include/Requiring - Destiny's Player - 23-09-2015

Also, is it just me being a ninny or there's a "--@shared" missing? Or is it not needed in this case?


RE: [Help] Include/Requiring - Person8880 - 23-09-2015

(23-09-2015, 05:57 PM)Destinys Player Wrote: Also, is it just me being a ninny or there's a "--@shared" missing? Or is it not needed in this case?
I think he's including this file from another file which presumably has --@shared.