Author Topic: Ulx completes  (Read 10831 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #15 on: June 01, 2013, 08:51:47 AM »
This is our fault, and we have it on our bug list. Sorry, you'll just have to make the command lower case in the mean time.
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #16 on: June 01, 2013, 10:05:18 AM »
Ah thats brilliant news :), i was banging my head against the wall :P, btw, i would really like to learn lua inside out, any books/materials that you would recommend reading?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #17 on: June 01, 2013, 10:08:18 AM »
My recommendations depend on previous experience. Do you have any formal college training in programming? How long have you been programming? Do you know what a pointer is (without looking it up)?
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #18 on: June 01, 2013, 10:43:57 AM »
No, i took an interest in lua when i had to program stupid turtles in minecraft, i didn't do much but then a friend offered me a coding position on his server and since then i've done a lot of coding for lua. Its all self taught, i've been coding in my spare time for about 6 months now i would say. And no i don't know what a pointer is.
« Last Edit: June 01, 2013, 10:45:37 AM by skillz »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #19 on: June 01, 2013, 11:08:02 AM »
I'd recommend reading Programming in Lua. Even though that online edition is aimed at 5.0, most everything remains applicable. Read it front to back; it has lots of good examples that will get you thinking. After that you should go more meta with books like The Pragmatic Programmer (well worth the money). Read up on Jeff Atwood's blog as well as Joel Spolsky. Yes, this takes time and it's not directly Lua-related, but it's how you become a good programmer.
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #20 on: June 01, 2013, 11:28:51 AM »
Consider them read, I might buy a kindle first though.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #21 on: June 01, 2013, 02:06:23 PM »
Once you've done all that and you know what pointers are (I'm sure they'll be covered in that book or blogs somewhere), you should read up on some of the Lua implementation details. It made a pretty significant impact on how I approached my code after I looked into it. Particularly in how I use tables -- the way Lua hybridizes tables is quite cool.
Experiencing God's grace one day at a time.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #22 on: June 01, 2013, 02:35:18 PM »
Our issue with command case-sensitivity has now been fixed.
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #23 on: June 01, 2013, 02:43:30 PM »
Thats brilliant :), also
Code: [Select]
function ulx.equipment( calling_ply, target_plys, equipment )
if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else
for i=1, #target_plys do
target_plys[i]:GiveEquipmentItem(tonumber(equipment))
end
ulx.fancyLogAdmin( calling_ply, "#A gave #T " .. equipment, target_plys)
end
end
local equipment = ulx.command( CATEGORY_NAME, "ulx give equipment", ulx.equipment )
equipment:addParam{ type=ULib.cmds.PlayersArg }
equipment:addParam{ type=ULib.cmds.StringArg, completes=ulx.get_equipment, hint="Equipment", error="Invalid equpiment:\"%s\" specified", ULib.cmds.restrictToCompletes }
equipment:defaultAccess( ULib.ACCESS_SUPERADMIN )
equipment:help( "Give <target(s)> specified equpiment." )

this is my code now but, after i changed the function name to lowercase i also had to change the name of the command that appears on the right of the xgui to lowercase as i got the same problem, just to let you know.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #24 on: June 01, 2013, 02:55:23 PM »
I don't understand what you mean. Try explaining it a different way?
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #25 on: June 01, 2013, 03:25:30 PM »
Code: [Select]
function ulx.equipment( calling_ply, target_plys, equipment )Was originally in upper case, i had to remove the upper case. However i got the same error.
I then had to change:
Code: [Select]
local equipment = ulx.command( CATEGORY_NAME, "ulx give equipment", ulx.equipment )specifically "ulx give equipment" into lower case otherwise i got the same error. Sorry for being unspecific, when i read back on it it was quite vague.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Ulx completes
« Reply #26 on: June 01, 2013, 03:33:40 PM »
You're saying you had to change the case of the function? Lua is a case-sensitive language, this doesn't have anything to do with ULX. :P
Experiencing God's grace one day at a time.

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #27 on: June 01, 2013, 04:11:21 PM »
*Epic facepalm*, i thought you were talking about case sensitivity on the function not the other bit hehe, well lesson learnt. Do you have steam? If you would like to add me, http://steamcommunity.com/id/Skillz1/ I won't be quizing you with questions, i keep steam for friends not contacts. :)
« Last Edit: June 01, 2013, 04:17:56 PM by skillz »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Ulx completes
« Reply #28 on: June 01, 2013, 08:41:12 PM »
Pretty sure it won't fix all your issues, but;
1) Always use lower case commands. (Strongly recommend 'getequipment', not 'GetEquipment'. Same for function names, etc. Lua is case sensitive, just easier to keep all of one type of thing the same. ULX does many checks already where it forces stuff to.lower.
2) Do you have CATEGORY_NAME defined? (This tells ULX where to put it in a menu, and XGUI what tab to put it under)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline skillz

  • Newbie
  • *
  • Posts: 29
  • Karma: 1
Re: Ulx completes
« Reply #29 on: June 02, 2013, 03:50:50 AM »
I don't see that case sensitivity on the functions would be a problem, i normally just copy and paste the names so i never make mistakes when calling them. However i will keep an eye on any problems that arise. Yes, i've got the the name defined at the top of the page. Thanks for the suggestions anywho :).