mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
UiDocument
This commit is contained in:
parent
c902ed506b
commit
1dd0e9f939
17 changed files with 257 additions and 42 deletions
|
|
@ -51,6 +51,16 @@ bool lua::LuaState::getglobal(const std::string& name) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool lua::LuaState::hasglobal(const std::string& name) {
|
||||
lua_getglobal(L, name.c_str());
|
||||
if (lua_isnil(L, lua_gettop(L))) {
|
||||
lua_pop(L, lua_gettop(L));
|
||||
return false;
|
||||
}
|
||||
lua_pop(L, lua_gettop(L));
|
||||
return true;
|
||||
}
|
||||
|
||||
void lua::LuaState::setglobal(const std::string& name) {
|
||||
lua_setglobal(L, name.c_str());
|
||||
}
|
||||
|
|
@ -196,6 +206,18 @@ int lua::LuaState::createEnvironment() {
|
|||
return id;
|
||||
}
|
||||
|
||||
void lua::LuaState::removeEnvironment(int id) {
|
||||
if (currentEnvironment == id) {
|
||||
setEnvironment(0);
|
||||
}
|
||||
lua_pushnil(L);
|
||||
setglobal("_N"+util::mangleid(id));
|
||||
}
|
||||
|
||||
int lua::LuaState::getEnvironment() const {
|
||||
return currentEnvironment;
|
||||
}
|
||||
|
||||
void lua::LuaState::setEnvironment(int id) {
|
||||
if (id == 0) {
|
||||
getglobal(":G");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue