Skip to content

(enh) moonscript supports eval now #1800

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

Merged
merged 2 commits into from
Jan 9, 2022
Merged

Conversation

joshgoebel
Copy link
Collaborator

No description provided.

@@ -91,6 +108,9 @@ static bool initMoonscript(tic_mem* tic, const char* code)
return false;
}

lua_setglobal(lua, "_ms_loadstring");
lua_getglobal(lua, "_ms_loadstring");
Copy link
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
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
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.

Copy link
Owner

@nesbox nesbox left a comment

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