dot notation versus semicolon.

Mar 4, 2009 at 7:29 AM
Hi,

Though i have programmed in various languages, i am new to LUA.  I noticed your ide supports the "." notation when referencing methods in addition to the ":".  Is that by design and specific to this ide or does LUA support that also?

example:

    TxtName.SetText(UnitName(

"player"));

seems to work the same as :
    
    TxtName:SetText(UnitName("player"));

 

Coordinator
Mar 9, 2009 at 5:43 PM
Lua can be a bit confusing for new developers, but there is a Lua language reference on the Web that goes through all of the language semantics - http://www.lua.org/manual/5.1/manual.html. Note that there are some changes as libraries that do things like File I/O are not included in the Wow Lua script compiler.

To your question, both notations are technically correct although IntelliSense should provide different semantics based on dot "." versus colon ":"

From the Lua reference, section 2.5.8
A call v:name(args) is syntactic sugar for v.name(v,args), except that v is evaluated only once.

Hope this helps,
-Dan