-
Notifications
You must be signed in to change notification settings - Fork 30
SVCD::add_{service,attribute} [OK] #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Please can you merge in from master so that this can auto merge? |
|
||
lua_pushstring(L, "blsmap"); | ||
lua_gettable(L, 2); | ||
lua_pushstring(L, svc_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is better to use lua_pushvalue(L, 1) here (and elsewhere where you push the svc_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Will do.
This is looking very good. I think you need to set up a test for it and try it out a bit, but you are definitely on the right path! |
I have a test running here: |
Looking good. The SVCD init function has been merged into master, so can you merge master into your branch so that it applies cleanly? |
Conflicts: natlib/svcd.c
Merged master onto my branch to enable automatic merging back to master. |
lua_gettable(L, 2); | ||
lua_pushvalue(L, 1); //svc_id @ index 4 | ||
lua_pushlightfunction(L, libstorm_bl_addservice); | ||
lua_pushvalue(L, 1); //svc_id @ index 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you're trying to do with the pushvalue() function. I see the comment says that you want to get svc_id that's at index 4 but you push the value that is at index 1. According to my understanding this should be pushing SVCD.blsmap onto the stack again since it is at index 1 of the stack.
EDIT: My understanding of the stack was wrong. This works correctly!
PB4J
Everything looks good but it some cases it might be easier to refer from the top of the stack (i.e. use negative numbers) |
Sharp on the comments. Looks good
|
Code looks good. I like that you have commented your code. It makes reviewing and debugging much simpler! |
|
||
// Lua: storm.n.svcd_add_service ( svcd_id ) | ||
// Add a new service to the service daemon | ||
// this must be called before SVCD.advertise() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this comment was pulled from the lua version, but the current implementation advertises automatically so this is no longer needed (in either lua or c).
Still figuring this stuff out but looks good to me. Really like the commenting shows changes in index number between the different functions. Running with Scissors |
Looks good to me. |
Ported svcd:add_service and svcd:add_attribute to Lua C functions.