[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: odd typo, what's happening
- From: "Soni L." <fakedme@...>
- Date: Thu, 17 Dec 2015 21:51:07 -0200
On 17/12/15 09:25 PM, Thijs Schreijer wrote:
I ran into the following;
local v = {type = "timestamp"} -- added to run it
if v.type == "number" or v .type == "timestamp" then -- actual code
end
Notice above, the second `v.type` has a typo with an extra space; `v .type`. I'd expected an error, but it runs fine.
Why?
Thijs
What if you replace .name with ["name"]? It becomes `v ["type"]`.
You can add spaces around . in many languages, including C, C++ and
Java. You can even add line breaks! E.g.
local dog = DogBuilder() -- Also works when using :
. setName "Doggy"
. setType "Poodle"
. build()
--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.