[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua C API questions
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 5 Apr 2015 12:43:12 +0100
One of the things I implemented in Ravi is optional static typing so
the compiler enforces types on local variables annotated with type
information. I am now starting to assess the impact on the C API and I
immediately noticed that the API provides lua_xmove() which can break
the type system as it knows nothing about the expected types.
I am looking into the C API code and will eventually figure things out
but it would be a huge help if following questions could be answered:
1. I think it is invalid for a C function to amend the stack beyond
what it is given to it - but I see that there is only an assert to
this effect which obviously is an optional check. My question is why
is this check an assert and not something stronger like a runtime
2. Functions like luax_move() that copy stack values - are there use
cases where such functions could amend the values in local variables
of a Lua function? I take it that the Debug API would allow this to
happen - but is there any other scenario where this can happen?
3. Is it the case that all other APIs go via the core API in lapi.c,
so that if I focus on this then it will resolve any issues with the
rest of the APIs?
Thanks and Regards