lua-users home
lua-l archive

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


Hi,

Finally, I made it to upgrade to Lua4.0(alpha).
Here are my (unpleasant) findings, some of which concern the
list of incompatibilities, but there is also one severe bug.

 * 'gc' tagmethod not settable from Lua
 * somewhere I learned, that type() returns two values: type and tag.
   Although it was undocumented, it is a feature that disappeared.
   And its disappearance produces errors that are not at all obvious.
 * lua_seterrormethod disappeared. (Why?)
 * lua_State argument needed also in non-reentrant programs for luaL_verror()
 * how about a little guide on adapting custom made main-programs?
	(creating the lua_State, using begin/endblock() for opening libs..)
 * below is a program that screws up the internal Lua-Stack. Doesn't look
   really dangerous, does it?
   Changing the if-condition to 1 changes the bug to a 
   segmentation violation. Using replacement (2) works around the bug.
   (Don't ask me, how I found that =:-0 )

Sorry, if some of this has been reported on the list before. I couldn't
follow the busy discussion of the last weeks very thoroughly.
(maybe Lua4.0beta will change everything, but I had the time for 
upgrading now, not in October :-(

ciao
Stephan

PS: I also had to dig into the sources a little deeper, because I need
a version of foreach which has repeatable order also for string indices.
Something comparable to foreachi, but -- for strings. Easiest way seems
to be to use qsort before iterating. Unfortunately using memcpy and qsort
to do the job requires low-level access to internal data structures..
I had posted a suggestion of "sortedforeach" some time ago and I still
wonder, whether I'm the only one who needs this predictable ordering?

BTW: what is a tag, that is guaranteed to be invalid? -2 ?

----------------------------------------------------------------------
$debug

function func1 () end

function func2()
    local a

    if nil then 
-- (1) if 1 then
        print("T1")
        a={func1()} 
-- (2)  a={}; a[1]=func1()
   end 
   print("T2") -- print is no longer print..
end

func2()

--------------------------------------------------------------------------
 Stephan Herrmann
 ----------------
 Technical University Berlin
 Software Engineering Research Group
 http://swt.cs.tu-berlin.de/~stephan
 phone: ++49 30 314 73174         
--------------------------------------------------------------------------