diff options
author | Mattes D <github@xoft.cz> | 2015-06-20 15:37:41 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-06-20 15:37:41 +0200 |
commit | e06dd8f20ec3e6817e5638d5101cb8dc776846b4 (patch) | |
tree | 7400062806953c5fc1d8abd3ab9eaa74800d4872 /src/Bindings/LuaState.cpp | |
parent | Merge pull request #2255 from cuberite/LoadablePieces (diff) | |
download | cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar.gz cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar.bz2 cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar.lz cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar.xz cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.tar.zst cuberite-e06dd8f20ec3e6817e5638d5101cb8dc776846b4.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): |