What's the dumbest mistake you've ever made in lua?
171 replies, posted
[CODE]`Swep.printname = AR2[/CODE]
When i start gmod to test-it
[CODE]lua/weapons/weapon_oicw (shared.lua):155, Unexcepted symbol near EOF [Or atleast something like that][/CODE]
Happens a lot due to my keyboard.
[lua]
if (true) do
doCoolStuff()
end
[/lua]
I don't know why, but recently i'm doing this mistake quite often.
And its so minor that I rarely notice it before starting the script.
[code]
()
[/code]
Those two keys are the bane of all evil in the world.
I often find myself doing:
[CODE]ent:SetParent() = toparent[/CODE]
Trying to fix a script and forgetting to upload it to the server, sometimes it takes me in-excess of an hour to figure out.
I'm new to lua, and coming from Java, I always forget "then" after my if statements. Of course, I don't put curly braces either.
Trying to learn it.
I spent about fifteen minutes trying to fix my broken lua when I realized I did this:
function ( )
my god
[CODE]Fuunction M:Initilize{}[/CODE]
Exactly as you see it :D . I'm still learning though.
Wondering why my VGUI full of DModelPanel's is lagging the first time i open it, trying 1000 different solutions. Remembering util.PrecacheModel()...
FML
I've got quite a few... the first one was when I was working on a fretta gamemode for the contest a year back, and a single tiny typo (it was a mismatched parenthesis iirc) added in as a last-second bugfix for another minor bug... broke the entire gamemode when it was submitted to garry. Our gamemode was amazing too, I'm pretty sure it would have placed if I hadn't ruined it D:
Second, just yesterday I figured out why the slab wouldn't show up in my infinite map mod-- it turns out it was because I accidentally capitalized a variable, making it nil, which made it zero out the cell contents when players spawned... so yeah, capitalization in general.
Lastly... hmmm... I guess I'd have to go with the time I named a variable "type" and then tried to use the "type" function :/
[code]if (value = value) then //stuff end[/code]
[QUOTE=Fatman55;31718171][code]if (value = value) then //stuff end[/code][/QUOTE]
== not =
[QUOTE=Banana Lord.;31718211]== not =[/QUOTE]
Read the title and then you'll notice why I posted that.
[editline]13th August 2011[/editline]
I do that like 3 out of 5 times :v:
[QUOTE=Fatman55;31720548]Read the title and then you'll notice why I posted that.
[editline]13th August 2011[/editline]
I do that like 3 out of 5 times :v:[/QUOTE]
oh oops for some reason I thought this was wdynhw
[QUOTE=Fatman55;31718171][code]if (value = value) then //stuff end[/code][/QUOTE]
What comparing the same value or commenting the end? :v:
When I tried to edit a weapon base and I dont know shit about lua.
[QUOTE=Grocel;31726608]What comparing the same value or commenting the end? :v:[/QUOTE]
No, typing just = instead of ==
Re-posting what happened to me a long time ago
As for today, I still don't know what I did wrong.
[img]http://i53.tinypic.com/30djvjl.png[/img]
trying to understant what you guys are talking about... and what mistakes your making
[QUOTE=bennyg;31755558]Re-posting what happened to me a long time ago
As for today, I still don't know what I did wrong.
[img]http://i53.tinypic.com/30djvjl.png[/img][/QUOTE]
Two things are getting printed at the exact same time:
[img]http://dl.dropbox.com/u/32605179/FP/time.gettime.png[/img]
[QUOTE=Jova;30729757]I fucking hate when I forget to put () at the end of a function and sometimes I go blank cause I don't know the problem then i call myself retarded for not noticing it sooner.[/QUOTE]
^This.
Happens to me quite often, and it annoys the hell out of me.
Anyways, my brother thought it would be funny to switch the extensions to run with the wrong programs.
So basically I was programming a .PNG picture file for about 45 minutes wondering what the fuck all the characters were. Not really a Lua mistake, just a coding error in general.
[QUOTE=DogLatrop;31756502]Two things are getting printed at the exact same time:
[img]http://dl.dropbox.com/u/32605179/FP/time.gettime.png[/img][/QUOTE]
Heh. Thanks a lot, one of the mysteries of my life solved.
[CODE]for k,v in [U]paris[/U](player.GetAll()) do .... end[/CODE]
this one, it's pretty hard to notice it.
Would be kind of resource intensive to loop through a table in a huge city like Paris.
I make that mistake sometimes as well, but since I touch type, I immediately see it.
Not my mistake but perps, running 6 mysql queries in one function when you really only needed 1.
I confused Lua's english-y syntax for Applescript.
#1 Editing DarkRP.
#2 Using notepad instead of notepad++.
[code]
'in' expected near '('
[/code]
:pwn:
[lua]
for i=1, pairs( player.GetAll() ) do print(k, v) end
[/lua]
:suicide:
[QUOTE=c-unitV2;31928235][code]
'in' expected near '('
[/code]
:pwn:
[/QUOTE]
[lua]
for i=1, #player.GetAll() in pairs( player.GetAll() ) do print(k, v) end
[/lua]
:P
Sorry, you need to Log In to post a reply to this thread.