Thanks Milind and Antonio,

I'll have to study that up.

Regards,
John



On 10/07/2015 1:40 p.m., Milind Gupta wrote:
The explanation is here : http://www.lua.org/manual/5.3/manual.html#3.4.11

Function definition is like this actually:
functiondef ::=*function*  funcbody
funcbody ::= ‘*(*’ [parlist] ‘*)*’ block*end*
So in your example this works:
box[key].click = function(self,L,C)
end
The other way is just syntactic sugar and the does not accept square brackets.
Milind

On Thu, Jul 9, 2015 at 5:45 PM, John Huttley <j...@mib-infotech.co.nz <mailto:j...@mib-infotech.co.nz>> wrote:

    Hi,
    I've been doing a bit of programming with IUP LUA under windows.

    And have discovered this oddness.
    ===========
    require( "iuplua" )
    require( "iupluacontrols" )

    box = {}
    key = "999"

    box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}


    local box_key = box[key]    -- This works
    function box_key:click_cb(L,C)
    end


    -- The function def below doesn't like the [key], doesn't compile
    function box[key]:click_cb(L,C)
    end


    ========

    I'm at a loss to understand why the latter function doesn't compile.

    Any advice greatfully received.

    --John



------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to