lua-users home
lua-l archive

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


On Thu, 21 Sep 2006 11:26:38 +0530
"Gokul N" <gokul.n@hotmail.com> wrote:

> How to Avoid the use of namespace inside lua

I think it shouldn't be avoided, just make Lua behave as you want...
 
> The normal syntax would be Plum.vec3.
> Ex:
> 
> obj = Rngr:func( Plum.vec3 )
> 	Instead I want the syntax to be like
> obj = Rngr:func( vec3 );    //avoided the use of namespace
> 
> That is vec3 itself is like a dataType (Ex:int)

Do something like this:

 require "Plum"    -- Import your module
 vec3 = Plum.vec3  -- Make a global for vec3, you need this only once.

 obj = Rngr:func(vec3) -- Now use it ;-)

Cheers,

-- 
$ cat /usr/include/sys/errno.h
#define EPERM     1  /* Operation not permitted   */
#define ENOENT    2  /* No such file or directory */
#define ESRCH     3  /* No such process           */
#define EINTR     4  /* Interrupted system call   */
[...]
#define EMACS   666  /* Editor Too Large          */
$

Attachment: signature.asc
Description: PGP signature