Comments (5)
Hi Philipp
Thanks. I've just corrected it. I am also contributing this
correction to Compat-5.2 (I think yours have a bug also: lua_settable(L,
-3), because lua_pushccloseure pops the upvalues from the stack.
Thanks,
Tomás
On Fri, 20 Sep 2013, Philipp Janda wrote:
luaL_setfuncs
insrc/compat-5.2.c
doesn't work ifnups
> 0. See keplerproject/lua-compat-5.2@adf9db4a5. Currently you don't need upvalues for this module, so this is not a pressing issue ...
Reply to this email directly or view it on GitHub:
#4
from md5.
I believe my version was correct (and my tests agree with me):
The initial layout when luaL_setfuncs(L, l, 2)
is called:
table|up1|up2
then after lua_pushstring
:
table|up1|up2|name
then after the loop pushing all upvalues:
table|up1|up2|name|up1|up2
then after the lua_pushcclosure
call:
table|up1|up2|name|closure
So for the lua_settable
index we have to skip the name, the closure, and the upvalues to get the table ...
The table is at -5
which is -(nups+3)
!
from md5.
Hi Philipp
Sure, you were right from the begining. Please forgive my
stubbornness.
Regards,
Tomás
On Sat, 21 Sep 2013, Philipp Janda wrote:
I believe my version was correct (and my tests agree with me):
The initial layout whenluaL_setfuncs(L, l, 2)
is called:
table|up1|up2
then afterlua_pushstring
:
table|up1|up2|name
then after the loop pushing all upvalues:
table|up1|up2|name|up1|up2
then after thelua_pushcclosure
call:
table|up1|up2|name|closure
So for thelua_settable
index we have to skip the name, the closure, and the upvalues to get the table ...
The table is at-5
which is-(nups+3)
!
Reply to this email directly or view it on GitHub:
#4 (comment)
from md5.
No problem :-)
Btw., the lua_settable(L, -(nup + 3))
was your code to begin with ...
from md5.
Hi Philipp
On Mon, 23 Sep 2013, Philipp Janda wrote:
No problem :-)
Thanks,Btw., the
lua_settable(L, -(nup + 3))
was your code to begin with ...
In fact, it was a careless translation of the original
implementation of luaL_setfuncs from Lua 5.2.0 code. It just happened
to be right by accident :-)
Regards,
Tomás
from md5.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from md5.