Uniqueness of references

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Uniqueness of references

Martin Stone
If I get two references to the same Lua object with lua_ref(), should they have the same integer value?  

I'm trying to match objects passed in subsequent calls to my API:

	function myFunc() ... end
	
	registerObject(myFunc)
	...
	unregisterObject(myFunc)

Currently when I try to compare the references obtained in my C implementations of these registration functions, I get different values.  Is this right?  Is there a way around it?

Reply | Threaded
Open this post in threaded view
|

Re: Uniqueness of references

Diego Nehab-3
Hi,

> If I get two references to the same Lua object with lua_ref(), should 
> they have the same integer value?  
> 
> I'm trying to match objects passed in subsequent calls to my API:
> 
> 	function myFunc() ... end
> 	
> 	registerObject(myFunc)
> 	...
> 	unregisterObject(myFunc)
> 
> Currently when  I try  to compare  the  references obtained  in my  C
> implementations of these registration functions, I get different values.
> Is this right? Is there a way around it?

They are and should be different: you might want to have two independent
locks on a  single object. To compare objects pointed  to by references,
first get the objects themselves on  the Lua stack (lua_getref), and
than compare them (lua_equal).

Regards,
Diego.


Reply | Threaded
Open this post in threaded view
|

RE: Uniqueness of references

Martin Stone
In reply to this post by Martin Stone
> They are and should be different: you might want to have two independent
> locks on a  single object. To compare objects pointed  to by references,
> first get the objects themselves on  the Lua stack (lua_getref), and
> than compare them (lua_equal).

Aha!  I forgot about lua_equal().  Thanks.

Martin.

Reply | Threaded
Open this post in threaded view
|

Compiling with the free Borland compiler

David Cuny
Is there a makefile for the Borland free compiler (BCC 5.5)?

If not, I'll settle for a Windows version of the gllua... :-)

Thanks!

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Denis Andreev
It is completely not difficult to modify available files for this compiler. 
It is just necessary to take into account, that in BCC55 the option is used 
!include and a little bit to modify definitions.

>Is there a makefile for the Borland free compiler (BCC 5.5)?
>If not, I'll settle for a Windows version of the gllua... :-)

--Denq




Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
Denq wrote:

> It is completely not difficult to modify available files for this compiler.
> It is just necessary to take into account, that in BCC55 the option is used
> !include and a little bit to modify definitions.

I'm a Clueless Newbie when it comes to makefiles. I still compile my programs 
by typing:

   bcc myprog.c -omyprog.exe

So instructions like "just modify 'configure' to fit your compiler" assumes 
more competence than I have.

Is there a reason that Lua doesn't supply a series of standard makefiles 
(makefile.unx, makefile.b32, etc) for popular flavors of compilers? 
Otherwise, it just presents one more hurdle for people who would rather be 
coding in Lua instead of C, but aren't C experts.

Thanks!

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Luiz Henrique de Figueiredo
In reply to this post by David Cuny
>I'm a Clueless Newbie when it comes to makefiles. I still compile my programs 
>by typing:
>
>   bcc myprog.c -omyprog.exe

Then take everything in src and src/lua and do
	bcc -c *.c -olua.exe

>So instructions like "just modify 'configure' to fit your compiler" assumes 
>more competence than I have.

>Is there a reason that Lua doesn't supply a series of standard makefiles 
>(makefile.unx, makefile.b32, etc) for popular flavors of compilers? 

One reason is that we don't have easy access to other compilers.
This would be the ideal thing for the community to contribute and add to the
wiki.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
lhf wrote: 

> Then take everything in src and src/lua and do
> 	bcc -c *.c -olua.exe

Thanks. (Sorry about posting so many messages!)

--David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Philippe Lhoste
In reply to this post by David Cuny
> >I'm a Clueless Newbie when it comes to makefiles. I still compile my
programs 
> >by typing:
> >
> > bcc myprog.c -omyprog.exe
> 
> Then take everything in src and src/lua and do
> bcc -c *.c -olua.exe
> 
> >So instructions like "just modify 'configure' to fit your compiler"
assumes 
> >more competence than I have.

If so, I suggest you take a pre-compiled version of Lua.
You can find the binaries I generated for Lua 4.0 on my site, and there are
also official ones on the Lua site.
If you want the latest Lua 4.1-work3 binaries (for Windows), I can upload
them, or just send them to you.

> >Is there a reason that Lua doesn't supply a series of standard makefiles 
> >(makefile.unx, makefile.b32, etc) for popular flavors of compilers? 
> 
> One reason is that we don't have easy access to other compilers.
> This would be the ideal thing for the community to contribute and add to
the
> wiki.
> --lhf

Good suggestion, I can contribute for the "makefiles" (actually .dsw and
.dsp files) for VC6, both for 4.0 and 4.1. The former are availables on my site,
but the WikiWiki has probably a better visibility.

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

Sent through GMX FreeMail - http://www.gmx.net


Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
Philippe Lhoste wrote:

> If so, I suggest you take a pre-compiled version of Lua.

I've grabbed them, but I'd like to play with the OpenGL stuff. I didn't see 
any precompiled binary for that, except for perhaps Yindo.


> You can find the binaries I generated for Lua 4.0 on my site, and 
> there are also official ones on the Lua site.

Yes, I saw those. Thanks for making them available!

> If you want the latest Lua 4.1-work3 binaries (for Windows), I can upload
> them, or just send them to you.

If you've got binaries for glLua, just point me to an URL!

Thanks!

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

RE: Compiling with the free Borland compiler

Nick Trout-4
In reply to this post by David Cuny
> Good suggestion, I can contribute for the "makefiles" 
> (actually .dsw and
> .dsp files) for VC6, both for 4.0 and 4.1. The former are 
> availables on my site,
> but the WikiWiki has probably a better visibility.

I started a page: http://lua-users.org/wiki/BuildingLua

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
Nick Trout wrote:

> Then take everything in src and src/lua and do :- bcc *.c -olua.exe

Excellent. I'll give it a try. 

I assume the same thing will work with other libraries (glLua, etc?) I'll 
find out soon enough. :-)

Thanks!

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Enrico Colombini
In reply to this post by Philippe Lhoste
>If so, I suggest you take a pre-compiled version of Lua.

By the way, out of laziness I tried this morning to download the
precompiled lua for Linux from lua.org but both Netscape 4.5 and Mozilla
0.9.5 were unable to download it (Netscape took it as HTML, Mozilla
truncated it).

No great harm, I just compiled the source, but it would be nice if it was
downloadable.

  Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Luiz Henrique de Figueiredo
In reply to this post by David Cuny
>By the way, out of laziness I tried this morning to download the
>precompiled lua for Linux from lua.org but both Netscape 4.5 and Mozilla
>0.9.5 were unable to download it (Netscape took it as HTML, Mozilla
>truncated it).

Try ftp://ftp.lua.org instead of http://www.lua.org/ftp.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
OK, I got the thing to compile with the Borland compiler. It's only slightly 
different that what Phillipe suggested:

1. Take everything from 

  /include
  /src
  /src/lib
  /src/lua 

and place them into a single directory.

2. Run the following commands:

  bcc32 -c *.c
  bcc32 lua.c *.obj -olua.exe
  del *.obj
  del *.tds

It shouldn't be to difficult to turn this into a real makefile. I'll take 
another crack at it...

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

David Cuny
In reply to this post by Luiz Henrique de Figueiredo
I tried hacking the existing Makefiles, but the Borland make isn't standard. 
For example, it wants

  !include ...

instead of

  include

And rm has to be changed, etc...

I decided to try a different angle, and instead of copying the files, just 
specify the include directories:

  bcc32 -c -I"include" src\lib\*.c src\*.c src\lua\*.c
  bcc32 src\lua\lua.c *.obj -I"include;src;src\lib" -olua.exe
  del *.obj
  del *.tds

The first line appears to work fine, but the second line causes me no end of 
grief. If anyone has a clue what I'm doing wrong, could you send a clue my 
way?

Thanks.

-- David Cuny

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Philippe Lhoste
In reply to this post by David Cuny
> > If so, I suggest you take a pre-compiled version of Lua.
> 
> I've grabbed them, but I'd like to play with the OpenGL stuff. I didn't
see 
> any precompiled binary for that, except for perhaps Yindo.

Well, there is Doris (http://lua-users.org/wiki/DorisViewer), but I don't
see a binary for this. Not even the source, as announced :-( Nick probably got
too busy for other things.
There is also the SDL library for Lua
(http://sourceforge.net/project/showfiles.php?group_id=31763) Meteor Shower. I think SDL supports OpenGL, but I am
not sure, and I am even less sure that this port supports it...

> > You can find the binaries I generated for Lua 4.0 on my site, and 
> > there are also official ones on the Lua site.
> 
> Yes, I saw those. Thanks for making them available!

My pleasure, and my little contribution to this wonderful language.

> > If you want the latest Lua 4.1-work3 binaries (for Windows), I can
upload
> > them, or just send them to you.
> 
> If you've got binaries for glLua, just point me to an URL!

Actually, gllua is still officially (from the home page) for Lua 3.1...
I quickly scanned the mailing list archive, but if it seems there where some
attempts to port it to Lua 4.0 or more, I saw no official/usable release of
even a source code (except Steve's LuaDev for MacOS X...).
Now, perhaps someone here can prove me wrong :-)

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

Sent through GMX FreeMail - http://www.gmx.net


Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Thatcher Ulrich
On Jan 24, 2002 at 11:01 +0100, Philippe Lhoste wrote:

> There is also the SDL library for Lua
> (http://sourceforge.net/project/showfiles.php?group_id=31763) Meteor
> Shower. I think SDL supports OpenGL, but I am not sure, and I am
> even less sure that this port supports it...

Unfortunately, I don't have OpenGL bindings in there yet.  That would
be a welcome addition, but it hasn't really gotten anywhere near the
top of on my todo list.

-- 
Thatcher Ulrich <[hidden email]>
http://tulrich.com

Reply | Threaded
Open this post in threaded view
|

gllua (was: Compiling with the free Borland compiler)

Christian Vogler-2
In reply to this post by Philippe Lhoste
Hello folks,

On Thu, Jan 24, 2002 at 11:01:03AM +0100, Philippe Lhoste wrote:
> Actually, gllua is still officially (from the home page) for Lua 3.1...
> I quickly scanned the mailing list archive, but if it seems there where some
> attempts to port it to Lua 4.0 or more, I saw no official/usable release of
> even a source code (except Steve's LuaDev for MacOS X...).
> Now, perhaps someone here can prove me wrong :-)

I made a partial port of gllua to lua 4.0. You can find the link on
http://www.cis.upenn.edu/~cvogler/lua/tklua.html.

However, some things to keep in mind:

1. Callback functions are not implemented (hence the "partial" port).
2. The code for Windows is untested and might not even compile.
3. We use it only in conjunction with tklua, so I don't know how stable
   the standalone part is or whether it will even compile.

You are very welcome to hack away on it or even to use my port as a
basis for taking over the project, because I am not very keen on
supporting it at all. If you find and fix a bug, though, I would
welcome a patch.

Regards
- Christian

Reply | Threaded
Open this post in threaded view
|

Re: Compiling with the free Borland compiler

Enrico Colombini
In reply to this post by Luiz Henrique de Figueiredo
>Try ftp://ftp.lua.org instead of http://www.lua.org/ftp.

Netscape doesn't seem to be able to connect. If I try manually with a ftp
client, it accepts an "anonymous" user but if I try "ls" I get:

 ftp> ls
 425 Can't build data connection: Connection refused

  Enrico


12