Picon

Lua 3.1 Reference Manual in PDF

Thanks to Claudio Terra, the reference manual is now available in PDF at
	http://www.lmf-di.puc-rio.br/~terra/links4.html

This is the same reference manual found at the official Lua sites,
but with its original LaTeX source re-rendered with PostScript fonts and
converted to Acrobat PDF. All sections and function definitions are indexed,
and, as with any PDF file, it is fully searchable.

--lhf

Steve Dekorte | 4 Nov 07:32 1998

eGroups


Could someone add "ListSaver-of-lua <at> egroups.com" to the mailing list subscriber list?
This will allow www.eGroups.com to automatically archive the list and let people
search it via the web.

Thanks,
Steve

Roberto Ierusalimschy | 5 Nov 13:57 1998
Picon
Picon

Re: manipulating buffers in Lua

> Is there a reason that Lua has no APIs for manipulating memory buffers?

What exactly would you have in mind? What should be the API calls?
Would these buffers be visible in Lua, or only in C? Should they be a
new type in Lua?

> It's not hard to add, just curious about why it's not in there.

We thought about that for a while, but couldn't find satisfactory answers
(for us, I mean) for those questions...

-- Roberto

Samson, Lyndon (GEIS | 11 Nov 18:26 1998
Picon

LUA:Behaviour of strsub


The behaviour of the string library function 'strsub' seems non-standard
with respect to passing lengths greater than the actual string length. The
actual
behaviour is the return of an empty string, the expected behaviour is
truncation down to actual string length

example:
x="1234567890"

y=strsub(x,1,15)

y now equals "" instead of "1234567890"

maybe this could be changed? 

lyndon

Jon Kleiser | 13 Nov 02:17 1998
Picon
Picon

Attempt to push a NULL Cfunction

Dear Lua people,

I'm trying to put together a small (68K) Mac C application, using
lualib31_68K and CodeWarrior 11. I managed to execute some plain Lua
scripts, but I also need to write a few new functions in C, to be called
from Lua. However, when I launch my application and the luaL_openlib(...)
gets executed, I get:

   "API error - attempt to push a NULL Cfunction"

I'd be glad if anybody could suggest what I'm doing wrong. This is how my
"ezlualib.c" file looks:

char *rcs_ezlualib = "$Id: ezlualib.c,v 0.9 1998/11/12 21:12:00 jon Exp $";

#include <stdlib.h>
#ifndef __MACTCP__
#include <MacTCP.h>
#endif

#include "lualib.h"
#include "lauxlib.h"
#include "lua.h"
#include "eztcp.h"

static void ez_IPNameToAddr (void)
{
        OSErr   err;
        ip_addr addr;

(Continue reading)

Roberto Ierusalimschy | 13 Nov 14:42 1998
Picon
Picon

Re: Attempt to push a NULL Cfunction

>   "API error - attempt to push a NULL Cfunction"

Well, the error message is quite clear, although I have no idea why it is 
happening :-). It seems as if one of the function addresses in the array 
"ezlualib" is not properly initialized. If you have stdout (or something 
similar), I suggest a very simple test, just to be sure where is the 
problem: Try to print your function addresses, with something like 

printf("%p\n", ez_IPNameToAddr);

or better yet:

printf("%p\n", ezlualib[0].func);
printf("%p\n", ezlualib[1].func);
printf("%p\n", ezlualib[2].func);

Just to be sure, print also

printf("%d\n", (sizeof(ezlualib)/sizeof(ezlualib[0])));

     "Jo no creo en bruxas, pero que las hay las hay"

-- Roberto

Roberto Ierusalimschy | 13 Nov 16:36 1998
Picon
Picon

Re: LUA:Behaviour of strsub


> The behaviour of the string library function 'strsub' seems non-standard
> with respect to passing lengths greater than the actual string length. The
> actual
> behaviour is the return of an empty string, the expected behaviour is
> truncation down to actual string length

I do agree that the current behavior is not the expected, but I am not sure 
what should be the expected one (truncation is one possibility, error is 
another). We will review this for version 3.2. BTW, does anyone know how 
other "strsub" (from other languages/systems) behave in such circumstances? 

-- Roberto
Claudio Terra | 13 Nov 18:22 1998
Picon
Picon

Re: Attempt to push a NULL Cfunction

Quoting Jon Kleiser on 98 11 12 23:20:
>I'm trying to put together a small (68K) Mac C application, using
>lualib31_68K and CodeWarrior 11. I managed to execute some plain Lua
>scripts, but I also need to write a few new functions in C, to be called
>from Lua. However, when I launch my application and the luaL_openlib(...)
>gets executed, I get:
>
>   "API error - attempt to push a NULL Cfunction"
>
>I'd be glad if anybody could suggest what I'm doing wrong.

Your code compiled and ran without problems on a CodeWarrior Pro 3 
installation. I've just commented out references to the "IPNameToAddress" 
function that is probably defined elsewhere:

static void ez_IPNameToAddr (void)
{
        OSErr   err;
        ip_addr addr=0;

        /*err = IPNameToAddress( luaL_check_string(1), &addr );*/
        SysBeep( luaL_check_number(1) ); /* it beeps very well */
       /* if (err != noErr) {
                addr = 0;
        }*/
        lua_pushnumber( addr );
}

I don't have CW 11 installed anymore, so I can't check if this is some 
sort of incompatibility between the two Warriors [the lib was made with 
(Continue reading)

Luiz Henrique de Figueiredo | 13 Nov 19:37 1998
Picon

new mirror

There's now a US mirror of Lua's ftp site at

	ftp://ftp.cdrom.com/pub/languages/lua

courtesy of David Greenman.

--lhf

Jon Kleiser | 13 Nov 19:51 1998
Picon
Picon

(No more) Attempt to push a NULL Cfunction

Thanks to Claudio and Roberto for their answers to my previous mail!

I asked a friend who has CodeWarrior Pro 3 to take a look at the 68K
Processor Code Generation settings in the lua31lualib.prj file, which I
wasn't able to open with my old CodeWarrior 11. The solution to my problem
seemed to be checking these options:

   4-byte Ints
   8-byte Doubles

   Far Data
   Far Method Tables
   Far String Constants

That kind of details is not my favourite topic ;)

Sincerely,

Jon Kleiser


Gmane