• What's the dumbest mistake you've ever made in lua?
    171 replies, posted
I don't remember specifics. [lua] local t = {} t[field] = "something", t[anotherfield] = 123, t[onemorefield] = Vector( 0, 0, 0 ) [/lua] It took me about 15 minutes to find the problem. It didn't help that it was set up like this previously. [lua] local t = { field = "something", anotherfield = 123, onemorefield = Vector( 0, 0, 0 ) } [/lua]
I made a crate, which removed the entities it put into itself. Forgot to check if the ent was a player, and ended up removing myself.
[QUOTE=jrj996;30999545]Why are you here? It says 'lua', as in the language you insult everyone on yet you can't do it. inb4box from Reherp[/QUOTE] This image pretty much sums it up: [img]http://gmodsvns.net/image/?di=U528[/img]
You guys are so easily trolled RetTurtl3 is most likely an alt of Cubar he seems just as dumb as him and at-least I hope there isn't two people in the world like that either way even Science has proven him self to be smarter than him so don't even waste your breath on him just rate him dumb and move on.
[QUOTE=Seiteki;31015454]I don't remember specifics. [lua] local t = {} t[field] = "something", t[anotherfield] = 123, t[onemorefield] = Vector( 0, 0, 0 ) [/lua] It took me about 15 minutes to find the problem. It didn't help that it was set up like this previously. [lua] local t = { field = "something", anotherfield = 123, onemorefield = Vector( 0, 0, 0 ) } [/lua][/QUOTE] Great. I'm not the only one that made that mistake. :P
[QUOTE=G-Foce85;30629288] function GM:Think() for _, v in pairs( player.GetAll() ) do if v:Nick() == "jrj996" then v:Ban( 0, "Bai" ) v:Kick( "Bai" ) end endend[/QUOTE] I think Seth did something similar to give himself the owner rank on his server.
[lua] hook.Add("Initialize","tmysql_connect",function() tmysql.initialize("host","user","pass",3306); end) [/lua] If you havent used mysql you wont know why this dosent work.
[QUOTE=MadParakeet;31043123]I think Seth did something similar to give himself the owner rank on his server.[/QUOTE] Oh my- Getout.
Started coding it, now I lost my ability to code PHP off by head.
[QUOTE=Gfoose;31044768]Started coding it, now I lost my ability to code PHP off by head.[/QUOTE] Nothing of value was lost. --- Spending any amount of time with stencils seems to have been a huge mistake - I can't even make copied code from other people work.
Typing fucntion instead of function. Also typing function)_ instead of function().
That's not stupid, that's a typo.
[QUOTE=FPtje;31052357]That's not stupid, that's a typo.[/QUOTE] It's still a mistake
[code]Entity:SetNWVar()[/code]
print.lua [lua] include 'main.lua' checkValid(); function print(arg) print(arg) end [/lua] main.lua [lua] include 'print.lua' function checkValid() return true end [/lua]
-snip-
[lua] al = { } al["a"] = "RTHFGSDHDFSP}{)_+&($@#%*$(#%F^" al["b"] = "RRNAHAFDYBRTBSFBH*()&#$%*$(#*(^" al["c"] = "CFGPADFBYRAYAEBYPAORAY*)((@#$^" al["d"] = "#mM|DRSVRTOSGHK*&)@#$^" al["e"] = "&840GHSBFSTUJHYD@#$%*()GHJK}^" al["f"] = "456$$SDRATVSRT#$%GFU)*(^" al["g"] = "@4NAEVYAERYERAYR*()&@#$GDF{^" al["h"] = "234RFREVYSDTSUBFTUNSFGJ:{}&(&(%^" al["i"] = "2346$DABRTDYBRSUFGJYI*(*)&#^" al["j"] = "(%}{:SFHVRSVY#$!%#$_&*H^" al["k"] = "TTR#@@#@%*&_GHDFJ^" al["l"] = "3456fghDFZBYTF)&_()@#$@^" al["m"] = "678#SFTNVJHOV<<<<<<SDSH#!$%*(^" al["n"] = "2345#7IKJYBEV*)&@#$$%DHG^" al["o"] = "FROPrF$%TARBUSFBGUYSFGHRTF#$@(*&^" al["p"] = "NOLP!@#%SDFHG&*()FGDHB%^" al["q"] = "347HSBRTUVSRTUSGJ@#$%&*()(*&FHJK^" al["r"] = "PPAERBDYIFHJDYBTIDYHGDTNDITY#$@%#^" al["s"] = "RnPQESBYIDTYJDGHJ@#$!$#%&*()J^" al["t"] = "SSTCGFHBIO((&*_(@@!%DF^" al["u"] = "#%7V@#%DSHFGNFY&*)(__+^" al["v"] = "XXR+!@#%!DSAGFSDYKF*&*)#$%@^" al["w"] = "SSNTRPDFOHRTKMHF:JTR55MFHG5IPR7THFO^" al["x"] = "347HfDFGRET%HFGhfGgfGHrth456346457#$%346$%&hfg^" al["y"] = "DSPRDFGSHRTUDHR%$$%TRT#%^" al["z"] = "4lfK>@!#$WEAGDFG*()*FGH#$#$@%^" function Convert( l ) if ( al[ l ] != nil ) then return al[ l ] else print( al[l] .. " was nil.") end end function stringtokey( li ) local mct = string.Explode( "^", tostring(li) ); local len = string.len( tostring(li) ); tst = { } for i= 1, tonumber(len) do table.insert( tst, Convert( mct[i] ) ) end return table.concat( tst ) end [/lua] not a mistake, i have no idea why i wrote this. i don't know when i wrote it. it was just on my desktop. i don't even see the point of it, really.
[QUOTE=LauScript;31061096][lua] al = { } al["a"] = "RTHFGSDHDFSP}{)_+&($@#%*$(#%F^" al["b"] = "RRNAHAFDYBRTBSFBH*()&#$%*$(#*(^" al["c"] = "CFGPADFBYRAYAEBYPAORAY*)((@#$^" al["d"] = "#mM|DRSVRTOSGHK*&)@#$^" al["e"] = "&840GHSBFSTUJHYD@#$%*()GHJK}^" al["f"] = "456$$SDRATVSRT#$%GFU)*(^" al["g"] = "@4NAEVYAERYERAYR*()&@#$GDF{^" al["h"] = "234RFREVYSDTSUBFTUNSFGJ:{}&(&(%^" al["i"] = "2346$DABRTDYBRSUFGJYI*(*)&#^" al["j"] = "(%}{:SFHVRSVY#$!%#$_&*H^" al["k"] = "TTR#@@#@%*&_GHDFJ^" al["l"] = "3456fghDFZBYTF)&_()@#$@^" al["m"] = "678#SFTNVJHOV<<<<<<SDSH#!$%*(^" al["n"] = "2345#7IKJYBEV*)&@#$$%DHG^" al["o"] = "FROPrF$%TARBUSFBGUYSFGHRTF#$@(*&^" al["p"] = "NOLP!@#%SDFHG&*()FGDHB%^" al["q"] = "347HSBRTUVSRTUSGJ@#$%&*()(*&FHJK^" al["r"] = "PPAERBDYIFHJDYBTIDYHGDTNDITY#$@%#^" al["s"] = "RnPQESBYIDTYJDGHJ@#$!$#%&*()J^" al["t"] = "SSTCGFHBIO((&*_(@@!%DF^" al["u"] = "#%7V@#%DSHFGNFY&*)(__+^" al["v"] = "XXR+!@#%!DSAGFSDYKF*&*)#$%@^" al["w"] = "SSNTRPDFOHRTKMHF:JTR55MFHG5IPR7THFO^" al["x"] = "347HfDFGRET%HFGhfGgfGHrth456346457#$%346$%&hfg^" al["y"] = "DSPRDFGSHRTUDHR%$$%TRT#%^" al["z"] = "4lfK>@!#$WEAGDFG*()*FGH#$#$@%^" function Convert( l ) if ( al[ l ] != nil ) then return al[ l ] else print( al[l] .. " was nil.") end end function stringtokey( li ) local mct = string.Explode( "^", tostring(li) ); local len = string.len( tostring(li) ); tst = { } for i= 1, tonumber(len) do table.insert( tst, Convert( mct[i] ) ) end return table.concat( tst ) end [/lua] not a mistake, i have no idea why i wrote this. i don't know when i wrote it. it was just on my desktop. i don't even see the point of it, really.[/QUOTE] The point is to confuse people i believe. Even if that was used as a code key, it would be so freakin long it would be unreadable.
Did Kuro put that on your desktop? Must be a backdoor. [highlight](User was banned for this post ("Drama" - Overv))[/highlight]
[lua] if variable then variable = false else variable = true end [/lua] :downs:
[CODE]while true do end[/CODE]
Recently found this in an old script: [lua]if v != 250 || v != 1 then if v > 250 then v = 250 else v = 1 end end[/lua] When I could of just done: [lua]v = math.Clamp(v, 1, 250)[/lua] Not huge, but still required a facepalm when I saw it.
[QUOTE=Jampot;31234680]Recently found this in an old script: [lua]if v != 250 || v != 1 then if v > 250 then v = 250 else v = 1 end end[/lua] When I could of just done: [lua]v = math.Clamp(v, 1, 250)[/lua] Not huge, but still required a facepalm when I saw it.[/QUOTE] Those are not the same. This [code]if v != 250 || v != 1 then[/code] is the same as [code]if true then[/code] Because if v is 250, it'll say [code]if false || true then[/code] which equals to true and if v is 1, it'll say [code]if true || false then[/code] which also equals to true. Oh and if v is any other number, it'll say [code]if true || true then[/code] This means the entire code can be shortened to [code]if v > 250 then v = 250 else v = 1 end[/code] EDIT: Overcomplicated explanation :V
Today's dumbest mistake, laziness taking its revenge: Was wondering why the thing I was doing did the stuff twice. Easy to fix though. [lua] function Important() local doit = dostuff() return doit and function_that_doesnt_return() or whatever() end [/lua]
I was using PlayerUse to open a npc menu and it would loop about 7 times opening a menu 7 times. Fucking confused the shit out of me for 2 weeks until I checked my hooks.
Biggest mistake?Trying to learn it.
Biggest mistake? I somehow can't get my first SWEP to work.
I should get some sleep... Defined a function that was supposed to modify a string. For some reason the string didn't get modified and I spent minutes debugging the modifier function with no results whatsoever. After the minutes I suddenly realized I just hadn't called the function anywhere..
[QUOTE=Python1320;31256711]I should get some sleep... Defined a function that was supposed to modify a string. For some reason the string didn't get modified and I spent minutes debugging the modifier function with no results whatsoever. After the minutes I suddenly realized I just hadn't called the function anywhere..[/QUOTE] The number of times I've finished writing a nice giant function and go "ahhh now let's test this", open up gmod, and realise I've forgotten to even call it or bound it to a hook/concommand/usermessage.
Happens a lot, but I always do this to fix holdtypes on outdated weapons [lua] SWEP:Initialize() (Or anything related to the deployment of it) end [/lua]
Sorry, you need to Log In to post a reply to this thread.