lua-users home
lua-l archive

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


Hi

>>a = { sin(1), cos(1) } gives "error: attempt to call a number 
value" ...
>This bug was reported here some weeks ago.
Sorry. I found the emails where it was already reported and the patch 
given by Edgar Toernig.

>>7) I think that the Lua 3.2 predefined _PROMPT variable was a good
>>idea but in Lua 4.0 it is removed.
>Only now we understood your point...But the functionality is still
>there, if you set the variable with your own prompt.
Yes, I know (it wasn't really a problem but just a little difference).

>>8) I prefer to use dynamic allocation memory instead of stack memory
>>for large variables to reduce the fixed stack size ...
>[lhf and ri answers ...]
Aaargh ... I put in danger myself!
I removed my changes to Lua and I added the freeing of the memory 
before calling lua_error() in my functions.
I know that Lua uses lbuffer.c's functions for many tasks and I changed 
manual_input() to create a new buffer before ldo():
[adds typed character using luaL_addchar()]
{
char *buffer = luaL_buffer();
int oldbuffer = luaL_newbuffer(0);
ldo(lua_dostring, buffer);
luaL_oldbuffer(oldbuffer);
}
I hope that this is safe enough.

>You can reduce the memory used by FuncState if you define smaller
>limits for some arrays: For instance, -DMAXLOCALS=50 and
>-DMAXUPVALUES=8 is more than enough for most applications.
If it doesn't give problems, then I'll reduce these limits.
Do you think that should be possible to put some limit values 
(MAXLOCALS,  MAXUPVALUES, MAXPRINT, ...) in a configuration file and 
sets them easily and dynamically at runtime or is it impossible to 
avoid the "longjmp problem" ?

>>... read the constant numbers with base from 2 to 26 by the
>>compiler ...
>So, I think using a function is the way to go here.
>Try
>	function X(s,b) return tonumber(s,b or 16) end
>and write
>	X"1FAB" or X("0101010",2)
I know that I can use a function, but most of my low-level functions 
have hexadecimal constants and converting them from the compiler makes 
a little bi
aster and smaller bytecode (my target CPU is a 486 
16/33/66MHz without math coprocessor). I'm not insisting on doing it in 
Lua, I just tell you why I made it.

Many thanks for your help and patience.

Bye
Mauro