|
| 06 Apr 2015 04:54 PM |
when people use == and ~= for stuff that isn't math
like
instead of
if humanoid ~= nil then
just use
if humanoid then
like srsly |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Apr 2015 04:56 PM |
You mad bro?
I use that all the time because I use 2008 style scripting. |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 04:56 PM |
well you need to start using modern stuff
people like me won't wanna help you w/ your code |
|
|
| Report Abuse |
|
|
wonuf
|
  |
| Joined: 28 May 2013 |
| Total Posts: 133 |
|
|
| 06 Apr 2015 04:57 PM |
I do that too
local AbstractMadnessIsMad = true
if AbstractMadnessIsMad then print('Mad bro?') end |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 04:58 PM |
@wonuf
you are a good human being |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 06 Apr 2015 04:58 PM |
I'd assume that the concept is quite difficult to understand at first. Trying to understand things as either 'True' or 'False' is sort-of similar to trying to learn a totally new language.
[very moisty] |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 04:59 PM |
it's not hard at all
if you put nothing, it assumes you but == true... or to check if its there, if you put "if not humanoid" then it's just like if humanoid ~= nil, but better. |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 06 Apr 2015 04:59 PM |
OMG Y THIS NO WORK IM RAGING !!!!!111
while false do if workspace ~= nil then script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent = true end end end
|
|
|
| Report Abuse |
|
|
wonuf
|
  |
| Joined: 28 May 2013 |
| Total Posts: 133 |
|
|
| 06 Apr 2015 04:59 PM |
| Ahah, but to be fair if you do use the old styles, it is easier to point out and go back to when editing scripts. |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 05:03 PM |
@025
best scripter award goes to.... `YOUU |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 06 Apr 2015 05:03 PM |
@AbstractMadness Although you're correct, I'd assume that you're an experienced Lua scripter. When I was slightly more of a newbie than I am now, I struggled to grasp the concept of a Boolean, event or parameter.
[very moisty] |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 05:04 PM |
i wouldnt say i'm experienced... idk where i'd put myself on the thingy for scoring
i think i'm bad because i can't create an actual game, or have no ideas.. so i can't display my skills... so yeah. it sucks having no imagination. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 06 Apr 2015 05:07 PM |
local thing = '' local othing = false if thing then print ('Not falsey') end; if thing ~= nil then print ('Exist') end; if othing then print('Oh noes') end; if othing ~= nil then print ('Exist') end; if thing == true then print('Nononono') end
That's why. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Apr 2015 05:07 PM |
function onTouch(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then local p = game.Players:FindFirstChild(hit.Parent.Name) if p ~= nil then p.PlayerGui.ScreenGui.Frame.Visible = true elseif p == nil then print("No layer") end elseif humanoid == nil then print("No Humanoid") end end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
wonuf
|
  |
| Joined: 28 May 2013 |
| Total Posts: 133 |
|
|
| 06 Apr 2015 05:08 PM |
| That script makes me die inside.. |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 06 Apr 2015 05:08 PM |
@AbstractMadness Scripting is a very small part of the gamedev process. There's all that other stuff, like the building, design and the such. I suck at anything other than making useless scripts, so I'd rather stick to helping people on the forum.
[very moisty] |
|
|
| Report Abuse |
|
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 06 Apr 2015 05:09 PM |
| That's because Lua works differently than a lot of other languages. The condition will pass in Lua if it is not nil and not false. In many languages (such as Java, where a lot of programmers are coming from) the condition has to evaluate to true to pass. Putting a non boolean (an object in most cases) in the condition is pretty unusual for someone who doesn't program in Lua or C++ all the time, and even for someone coming from C++ it's still pretty unusual. |
|
|
| Report Abuse |
|
|
wonuf
|
  |
| Joined: 28 May 2013 |
| Total Posts: 133 |
|
|
| 06 Apr 2015 05:09 PM |
---2008
function onTouch(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then local p = game.Players:FindFirstChild(hit.Parent.Name) if p ~= nil then p.PlayerGui.ScreenGui.Frame.Visible = true elseif p == nil then print("No layer") end elseif humanoid == nil then print("No Humanoid") end end
script.Parent.Touched:connect(onTouch)
---2015
script.Parent.Touched:connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then local p = game.Players:FindFirstChild(hit.Parent.Name) if p then p.PlayerGui.ScreenGui.Frame.Visible = true elseif not pthen print("No layer") end elseif not humanoid then print("No Humanoid") end end end . |
|
|
| Report Abuse |
|
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 06 Apr 2015 05:11 PM |
Also, just a tip, if p ~= nil then p.PlayerGui.ScreenGui.Frame.Visible = true else then --if the first condition is false, since it is the same boolean being evaluated (p to nil) then you automatically know p is nil, so you don't have to check what it is. print("No layer") end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Apr 2015 05:12 PM |
Those do the exact same thing. So why do people get mad over "omg ThAs NUt 3Fficeeeent"
Lua code fires in milliseconds so the time for an "efficient" code and "unefficient" code to do the EXACT same thing is useless to measure and is a waste of time. |
|
|
| Report Abuse |
|
|
vividtrip
|
  |
| Joined: 14 Oct 2008 |
| Total Posts: 2890 |
|
|
| 06 Apr 2015 05:14 PM |
@TimeTicks Not only does it look nicer (In my opinion), but it's good practice, I'd assume.
[very moisty] |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 06 Apr 2015 05:14 PM |
| And FYI, for code that is considered "Deprecated" who gives a rats ass? Until roblox convinces me that they will get rid of :Remove() and replace it with :Destroy() I'm still going to use :Remove(). They do the exact same thing. |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2015 05:14 PM |
| Because.. It's not the updated stuff. They wouldn't have updated for better things if they wanted you to still use the old things. |
|
|
| Report Abuse |
|
|