diff options
author | worktycho <work.tycho@gmail.com> | 2015-06-21 13:08:34 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-06-21 13:08:34 +0200 |
commit | 0096327c4ff8f69755a0ca438fcd08171e68c5d7 (patch) | |
tree | 7400062806953c5fc1d8abd3ab9eaa74800d4872 /src/Bindings/LuaState.cpp | |
parent | Merge pull request #2255 from cuberite/LoadablePieces (diff) | |
parent | Added basic support for loading village prefabs from files. (diff) | |
download | cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar.gz cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar.bz2 cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar.lz cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar.xz cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.tar.zst cuberite-0096327c4ff8f69755a0ca438fcd08171e68c5d7.zip |
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r-- | src/Bindings/LuaState.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 9814d1c85..a0fdecb8b 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -835,8 +835,12 @@ bool cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal) cLuaState::cStackValue cLuaState::WalkToValue(const AString & a_Name) { - auto path = StringSplit(a_Name, "."); + // There needs to be at least one value on the stack: + ASSERT(lua_gettop(m_LuaState) > 0); + + // Iterate over path and replace the top of the stack with the walked element lua_pushvalue(m_LuaState, -1); // Copy the stack value into the "working area" + auto path = StringSplit(a_Name, "."); for (const auto & elem: path) { // If the value is not a table, bail out (error): |