mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add data argument to container:add(...)
This commit is contained in:
parent
9befbb9795
commit
8e8cabf2d1
3 changed files with 26 additions and 1 deletions
|
|
@ -154,6 +154,22 @@ std::unique_ptr<Process> scripting::start_coroutine(
|
|||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] scriptenv scripting::create_environment(
|
||||
const scriptenv& parent
|
||||
) {
|
||||
auto L = lua::get_main_state();
|
||||
int id = lua::create_environment(L, (parent ? *parent : 0));
|
||||
lua::pushenv(L, id);
|
||||
lua::pushvalue(L, -1);
|
||||
lua::setfield(L, "CUR_ENV");
|
||||
|
||||
lua::pop(L);
|
||||
return std::shared_ptr<int>(new int(id), [=](int* id) { //-V508
|
||||
lua::remove_environment(L, *id);
|
||||
delete id;
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] scriptenv scripting::create_doc_environment(
|
||||
const scriptenv& parent, const std::string& name
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue