tomaka / hlua

Rust library to interface with Lua
MIT License
510 stars 48 forks source link

Implement Push for LuaTable #175

Open linkmauve opened 7 years ago

linkmauve commented 7 years ago

It’s currently impossible to push a LuaTable value on the stack, which makes it impossible to e.g. return a table from a module, to expose its API publicly in its namespace.

tpdickso commented 7 years ago

A LuaTable is a borrowed table from a lua context; in particular, borrowing a table requires AsMutLua, because reading and writing values from the table requires manipulating the lua stack. As long as the lua context is borrowed, it isn't guaranteed to be in a consistent state for other operations to be performed. Thus, it isn't actually possible to Push while you have a LuaTable borrowed. A solution might have to take a different form.