Please login or register.

Xuras

Author Topic: Chaotic cow's "I need help with Lua" thread  (Read 2004 times)

Chaotic Cow

  • Guest
Re: Chaotic cow's "I need help with Lua" thread
« Reply #30 on: 23 January, 2009, 00:14:37 am »
DListView.OnRowRightClick = function()

local MenuOptions = DermaMenu() // Creates the menu
MenuOptions:AddOption("Kick", function() Msg("Hello") end ) // Add options to the menu
MenuOptions:AddOption("Ban(5)", function() Msg("How") end )
MenuOptions:AddOption("Something", function() Msg("Are") end )
MenuOptions:AddOption("SomethingTwo", function() Msg("You") end )
MenuOptions:AddOption("?", function() Msg("?") end )
MenuOptions:Open() // Open the menu AFTER adding your options


end
end


I can double Click to open -- Which I don't want...

and I can right click columns -- Which I don't want...

How do I stop this?


Right Click does not open DermaMenu
« Last Edit: 23 January, 2009, 02:44:46 am by Chaotic Cow »

Chaotic Cow

  • Guest
Re: Chaotic cow's "I need help with Lua" thread
« Reply #31 on: 04 May, 2009, 19:07:46 pm »
Anyone can help me?

My Cow's Useful Pack...I put it on a server but...

I'm the only one who seems to be able to use it when I join.

I think i'm missing something like cl_init.lua

but idk what to put in it.

Christoffer395

  • Guest
Re: Chaotic cow's "I need help with Lua" thread
« Reply #32 on: 05 May, 2009, 07:39:15 am »
I think you made the addon clientside instead of serverside, if you actually made it serverside, then I don't know whats going on.

Offline Neko_Baron

  • New
  • Posts: 99
  • Cookies: 1
    • View Profile
Re: Chaotic cow's "I need help with Lua" thread
« Reply #33 on: 05 August, 2009, 01:06:17 am »
Gah! That ping meter code on the first page...

if you wanted to always show the condition of the ping then really it should be something like this

Code: [Select]
if (ping < 100)
   Yay
elseif (ping < 180)
   Hmmmm
else
   GAH STARTING TO LAG!
end
This avoids extra checks instead of always doing a check for all 3, plus the last condition doesn't need a check as it knows its not under 180 already.


Soul-Chicken

  • Guest
Re: Chaotic cow's "I need help with Lua" thread
« Reply #34 on: 05 August, 2009, 12:37:42 pm »
should be like:
Code: [Select]
if (ping < 50)
   Good Connection
elseif (ping < 100)
   OK Connection
elseif (ping < 180)
   Dodgey Connection
else
   Bad Connection, Go away.
end
Dont you need to use Return command?

Offline Neko_Baron

  • New
  • Posts: 99
  • Cookies: 1
    • View Profile
Re: Chaotic cow's "I need help with Lua" thread
« Reply #35 on: 05 August, 2009, 14:24:54 pm »
return is not needed in lua unless you require it to do so or want to end a function earlier, say if you wanted to like some kind of magic function and muting magic was possible.
Code: [Select]
function Magic(ply, cast)
   if (ply.mute = false) then
      if (cast = fireball & ply.magic >=10) then
         Cast fireball ect....
      end
      if (cast = iceball & ply.magic >=10) then
         Cast iceball ect....
      end
   end
end
you could instead
Code: [Select]
function Magic(ply, cast)
   if (ply.mute = false) then return end
   if (cast = fireball & ply.magic >=10) then
      Cast fireball ect....
   end
   if (cast = iceball & ply.magic >=10) then
      Cast iceball ect....
   end
end

Not the best example but does show the idea of it, plus its easier to read and cuts down the need to indent as much if done correctly.


Soul-Chicken

  • Guest
Re: Chaotic cow's "I need help with Lua" thread
« Reply #36 on: 07 August, 2009, 16:46:08 pm »
I see...
 :no:

 


SimplePortal 2.3.2 © 2008-2010, SimplePortal