• Categories.lua doesn't work
    11 replies, posted
Hi I'm having a few errors here, here's one of them. Can't figure it out. [ERROR] Lua is unable to understand file "darkrp_customthings/categories.lua" because its author made a mistake around line number 1. The best help I can give you is this: Right before the '{', Lua encountered something it could not make sense of. Hints: - Did you forget something here? (Perhaps a closing bracket) - Is it a typo? ------- End of Simplerr error ------- The thing is, I don't even have anything before the '{', I don't know why it would say this. I don't even have a space? This is my categories.lua DarkRP.createCategory{     name = "CT",     categorises = "jobs",     startExpanded = true,     color = Color(0, 0, 0, 255),     canSee = function(ply) return true end,     sortOrder = 10, } DarkRP.createCategory{     name = "212th",     categorises = "jobs",     startExpanded = true,     color = Color(0, 0, 0, 255),     canSee = function(ply) return true end,     sortOrder = 10, }   DarkRP.createCategory{     name = "CG",     categorises = "jobs",     startExpanded = true,     color = Color(0, 0, 0, 255),     canSee = function(ply) return true end,     sortOrder = 10, }   DarkRP.createCategory{     name = "41st",     categorises = "jobs",     startExpanded = true,     color = Color(0, 0, 0, 255),     canSee = function(ply) return true end,     sortOrder = 10, }  
You will probably be able to get more help from the Official DarkRP Forum.
thank you, i will try that
You are calling a function without the "()" Example of how it should be: MyFunctionWithAtable( { key1 = "here we have a key with a string", key2 = 5 } )
No, this isn't correct. You don't call DarkRP.createCategory like DarkRP.createCategory({, you call it the way OP posted. The documentation for the command is here: https://wiki.darkrp.com/index.php/DarkRP:Categories And the example given is: DarkRP.createCategory{ name = "Citizens", -- The name of the category. categorises = "jobs", -- What it categorises. MUST be one of "jobs", "entities", "shipments", "weapons", "vehicles", "ammo". startExpanded = true, -- Whether the category is expanded when you open the F4 menu. color = Color(0, 107, 0, 255), -- The color of the category header. canSee = function(ply) return true end, -- OPTIONAL: whether the player can see this category AND EVERYTHING IN IT. sortOrder = 100, -- OPTIONAL: With this you can decide where your category is. Low numbers to put it on top, high numbers to put it on the bottom. It's 100 by default. }
--[[ 29 Sep 2018joined 1threads 2posts philipj99 Hi I'm having a few errors here, here's one of them. Can't figure it out. [ERROR] Lua is unable to understand file "darkrp_customthings/categories.lua" because its author made a mistake around line number 1. The best help I can give you is this: Right before the '{', Lua encountered something it could not make sense of. Hints: - Did you forget something here? (Perhaps a closing bracket) - Is it a typo? ------- End of Simplerr error ------- The thing is, I don't even have anything before the '{', I don't know why it would say this. I don't even have a space? This is my categories.lua ]] Your top part is not done like this sir.
What do you mean by that?
thers no "--[[" and "]]" fx: --[[ here you can type notes without effect in the lua code ]]
That doesn't matter at all. You can call functions with or without parenthesis and even with a newline between the function and actually calling it as long as the function is followed by a string or a table. Lua 5.3 Reference Manual https://i.imgur.com/jcwzAAN.png https://i.imgur.com/lFsQwoD.png
@philipj99 The only things it could be is 1. You aren't showing us the entire file code (please use the code wrap to post code on the forums) 2. Your DarkRP isn't up to date 3. You aren't actually in the gamemode and are trying to run this code in a different gamemode. 4. You messed with the core files. If the code you provided is everything in that file then DarkRP.createCategory is nil for some reason, and that shouldn't happen if you have the gamemode installed, and are in the gamemode when you try to do whatever it is you're trying to do. You can get the most up to date version of DarkRP here: GitHub Just remember to also download: GitHub as well so you aren't making changes to the core files, which could also cause something like this. My suggestion would be to back up all of your jobs and whatever else, then reinstall using the links provided. UNLESS you haven't given us the full code in categories.lua
Oh sorry my bad then. That was very informative! Here have a coin!
That makes sense, I might have messed a little with the core files. I'll try reinstalling it completely.
Sorry, you need to Log In to post a reply to this thread.