Lua function Resource.AddWorkshop displays error.

Hi! In a recent update Garry’s mod has added a new function resource.AddWorkshop. (Http://wiki.garrysmod.com/page/resource/AddWorkshop). I ask this question, and to add this Lua code? I added it to the C:\srcds\garrysmod\lua\autorun file in which he created under the name workshop.lua and inserted code resource.AddWorkshop (“157450041”). After logging in to my server DarkRP generates this error here:

[ERROR] lua/autorun/workshopaddons.lua:7: attempt to call field ‘AddWorkshop’ (a nil value)
** 1. unknown - lua/autorun/workshopaddons.lua: 7

Screen:

So what to do? Server was created using SteamCMD. Thank you for Help!

Posting the lua inside the file would help, for a start.

All that is written in my file, it’s the code resource.AddWorkshop (“155830236”)

Screen:

[editline]10th July 2013[/editline]

Help, please!

There are [lua] tags for a reason

Try putting it inside autorun/server (create the folder if necessary)
If that doesn’t work, check that your server is in up to date.

Thank, now move the file to a folder. At the expense of the server, I updated it yesterday and today too.

[editline]10th July 2013[/editline]

Big Thanks for Help. All work! And i have a new question, how add more addons in this file?

If they are on Workshop, repeat resource.AddWorkshop but replace the workshop id with the ones you want. You can get the ID if you navigate to the addon and look at the URL.

Thanks again for your help, you helped me a lot with my server.

Remember to click the “mark as Solved” at the top.

Good, Thanks :slight_smile: