Skip to content
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

Plain C cached #3

Open
ghost opened this issue Jan 29, 2016 · 1 comment
Open

Plain C cached #3

ghost opened this issue Jan 29, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 29, 2016

In the name of fairness, maybe you should add a cached function call for the Lua C API. You can do this by looking up the function to call and storing it in the stack, then on each iteration you can then call lua_pushvalue[1] to copy the value (this would ensure the stack index is not popped when the function is called). Alternatively, you could store the function in the registry and use lua_geti [2] / lua_rawgeti [3].

[1] http://www.lua.org/manual/5.3/manual.html#lua_pushvalue
[2] http://www.lua.org/manual/5.3/manual.html#lua_geti
[3] http://www.lua.org/manual/5.3/manual.html#lua_rawgeti

@bagobor
Copy link
Owner

bagobor commented Jan 30, 2016

Thanks for idea.
I'm not very comfortable with Lua API notation, so please contribute via pull request.

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

No branches or pull requests

1 participant