Not pulling array from config

Hello my script isn’t pulling the jobs from the config
bellow is what my config looks like

Config = {
    jobs={
        ["miner"] = {
            start = {328.99,-209.45,54.09},
            colour = {0,255,0}
        },
        ["Carrot farmer"] = {
            start = {332.98,-210.87,54.09},
            colour = {255,0,0}
        },
        ["farmer"] = {
            start = {331.9,-207.17,54.09},
            colour = {0,0,255}
        },
    },
}

Resource.lua

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

shared_script "config.lua"

client_scripts {
    "@cf/locale.lua",
    "client.lua",
}

server_script "server.lua"

client.lua

CreateThread(function()
	while true do
		-- draw every frame
		Wait(10)
        for k,v in pairs(Config.jobs) do 
            local x, y, z = table.unpack(v.start)
            local r, g, b = table.unpack(v.colour)
            DrawMarker(1, x, y, z-1, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.0, 1.0, 1.0,r, g, b, 100, false, true, 2, false, false, false, false)
		
    end
end
end)

the error it is giving

https://gyazo.com/ab5246d02a4182d06fd76c6e27b72dc3

From my experience shared_script/shared_scripts only work in a fxmanifest.lua, if you are using a __resource.lua you will have to reference your config in your client_scripts

client_scripts {
    "@cf/locale.lua",
    "config.lua",
    "client.lua"
}

Still getting the same error

Config = {} 
   
Config.jobs={
        ["miner"] = {
            start = {328.99,-209.45,54.09},
            colour = {0,255,0}
        },
        ["Carrot farmer"] = {
            start = {332.98,-210.87,54.09},
            colour = {255,0,0}
        },
        ["farmer"] = {
            start = {331.9,-207.17,54.09},
            colour = {0,0,255}
        },
} 

Try this snippet instead.

1 Like

Works thank you :slight_smile:

1 Like