lua-users home
lua-l archive

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


The simple solution is to create some global empty function, and if you want
to pass empty function - pass this global.

function globalEmptyFunction()
end

function MyFunc(f)
    if f == globalEmptyFunction then ...
    else ...
end

Other than this, the only way I can think of is to use lua internals to
check that there are no instructions in the function, and I don't think it's
a nice thing to do.

Best Regards,
Grisha

----- Original Message ----- 
From: "Dan East" <dan@naxs.com>
To: <lua@bazar2.conectiva.com.br>
Sent: Wednesday, August 04, 2004 6:50 PM
Subject: Empty function determination


>   Lua functions are passed to my C code.  I wish to determine if the Lua
> function is empty.  Is this possible?
>
> --Empty function
> function foo()
> end
>
> --Empty function
> function foo2()
>   --this is an empty function
> end
>
> --Not empty
> function foo3()
>   global_bar=1
> end
>
>   Thanks.
>
>   Dan East
>