Skip to content

(enh) moonscript supports eval now - #1800

Merged
nesbox merged 2 commits into
nesbox:masterfrom
joshgoebel:eval_moonscript
Jan 9, 2022
Merged

nesbox merged 2 commits into
nesbox:masterfrom
joshgoebel:eval_moonscript

Conversation

@joshgoebel

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/api/moonscript.c Outdated
}

lua_setglobal(lua, "_ms_loadstring");
lua_getglobal(lua, "_ms_loadstring");

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno if there is a better way to do this... I was looking for lua_tee or something, but couldn't find.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't understand what's going on here :)
Also, could you pls move the "_ms_loadstring" to static const char _ms_loadstring[] = "_ms_loadstring" variable?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, Lua is stack based, so setting a global removes it from the stack so you have to put it back on the stack... I was looking for a "duplication item on top of stack" API, but didn't see it.

@nesbox nesbox left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@nesbox
nesbox merged commit 52bdfef into nesbox:master Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants