lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


No, I know about the colon operator and what not, I'm talking about the syntax, just look at this page and you'll see the 'print()' equivalent in this syntx.

On May 8, 2013, at 5:37 PM, Mark Gabby <mwgabby@gmail.com> wrote:

On May 8, 2013 3:30 PM, "Mason Mackaman" <masondeanm@aol.com> wrote:
>
> functions like gc:paint(output,x,y) (or something like that)
> I was just wondering if anyone has experience with that syntax for Lua and if you know where I could learn it and what its called.

That's the colon operator. It's equivalent to calling the function like this:
gc.paint( gc, output, x, y )

So, calling a function that's in the "gc" table with "gc" as the first argument. It's used mainly to make object-oriented programming in Lua easier. In this case, tables behave as objects.

You can read more about this in Chapter 6 of Programming in Lua: http://www.lua.org/pil/16.html