Problems transitioning from lua 2.5 -> lua 3.1

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

Problems transitioning from lua 2.5 -> lua 3.1

David Jeske-2
1) Function Syntax

Was it intended that this syntax which was valid in Lua 2.5 no longer
works in Lua 3.1? 

function foo.bar.foo(a,b,c)
end

-- or

function foo.bar:foo(a,b,c)
end

I've changed to use the new anonymous function syntax:

foo.bar.foo = function (a,b,c)
end

but dosn't this mean that the function won't have a 'name' in the
debugging information?


2) Lua2c - C2lua overflow

I'm having trouble with lua2c - c2lua overflows. I tried increasing the
STACK_SIZE in lua 3.1 but this had no effect. This code used to work in
lua 2.5. Can someone explain to me what this overflow actually means and
how I might figure out what is wrong?


-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problems transitioning from lua 2.5 -> lua 3.1

Luiz Henrique de Figueiredo
>From [hidden email] Sun Jun 28 20:26:54 1998
>
>1) Function Syntax
>
>Was it intended that this syntax which was valid in Lua 2.5 no longer
>works in Lua 3.1? 
>
>function foo.bar.foo(a,b,c)
>end
>
>function foo.bar:foo(a,b,c)
>end

not intended, but unavoidable.

>I've changed to use the new anonymous function syntax:
>
>foo.bar.foo = function (a,b,c)
>end
>
>but dosn't this mean that the function won't have a 'name' in the
>debugging information?

functions never had a name.
when printing a stack trace, what we do is to try to find the function among
the global variables. we never look inside tables.
so I can't see how you got the name of foo.bar.foo in 2.5.

>2) Lua2c - C2lua overflow
>
>I'm having trouble with lua2c - c2lua overflows. I tried increasing the
>STACK_SIZE in lua 3.1 but this had no effect. This code used to work in
>lua 2.5. Can someone explain to me what this overflow actually means and
>how I might figure out what is wrong?

overflow usually mean lack of lua_beginblock/lua_endblock.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Problems transitioning from lua 2.5 -> lua 3.1

Norman Ramsey-3
 > overflow usually mean lack of lua_beginblock/lua_endblock.

So here is another idea -- create a LUA_DEBUG version of the Lua API,
which among other things, tracks the source file and line of every
push.  Then, on stack overflow, you can dump the locations of the
offending C code.  I bet it would be a snap to diagnose overflows in
this scheme.

Norman