lua-users home
lua-l archive

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


On Wednesday 19 January 2011 00:14:45 Drake Wilson wrote:
> Quoth Steve Litt <slitt@troubleshooters.com>, on 2011-01-19 00:03:53 -0500:
> > Hi all,
> >
> > I've been RTFW all night but no joy when it comes to either running C
> > from Lua or running Lua from C. I tried this:
> >
> > http://heavycoder.com/tutorials/lua_embed.php
> 
> Jeez, what's ey doing?  You can't nest functions like that in standard
> C.  GNU C supports some of that as an extension, but still...

:-)

Yeah, I forgot about that. I just copied that function, and some of the locals 
above it that would have made for a "closure" :-) into their own function and 
called it, getting rid of all errors on that part of it.

> 
> Wow, and look at the brash and insulting "no content" message if you
> try to access the root of that site to see who the author is.
> 
> > It seems like my computer has /usr/lib/liblualib50.so.5 but no
> > corresponding liblualib51.*, and I'm using Lua version 5.1.4. My Ubuntu
> > is 9.10. If I knew the old version was the problem I'd upgrade, but I'd
> > hate to go through all that mess on anything but a very educated guess.
> 
> 5.0 doesn't have an exactly compatible interface with 5.1; there is no
> liblualib51.  I'd start with the 5.1 reference manual, but that's me.
> 
> > Is there anywhere on the web that has an up todate, for Lua5.1, bare
> > bones absolutely minimal example of Lua interfacing with C?
> 
> http://lua-users.org/wiki/SimpleLuaApiExample seems to have something like
> that, though I haven't read it enough to vouch for its quality.  Could you
> try that and see whether it works for you?

Thanks Drake. It worked for me. I had to mess with the library names, but once 
they were right it compiled no errors, no warnings. With -Wall there was one 
warning about implicit declaration of luaL_openlibs, but I'll figure that out 
later.

It will probably take me two days to figure out what this thing is doing, but 
now with a working program it's just a matter of time.

Thanks very much!!!

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt