summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index c6042ac62..81dcb0e67 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -863,7 +863,7 @@ void cLuaState::Push(const AStringVector & a_Vector)
int index = 1;
for (AStringVector::const_iterator itr = a_Vector.begin(), end = a_Vector.end(); itr != end; ++itr, ++index)
{
- tolua_pushstring(m_LuaState, itr->c_str());
+ Push(*itr);
lua_rawseti(m_LuaState, newTable, index);
}
}
@@ -916,6 +916,17 @@ void cLuaState::Push(const cLuaState::cRef & a_Ref)
+void cLuaState::Push(const ContiguousByteBufferView a_Data)
+{
+ ASSERT(IsValid());
+
+ lua_pushlstring(m_LuaState, reinterpret_cast<const char *>(a_Data.data()), a_Data.size());
+}
+
+
+
+
+
void cLuaState::Push(const Vector3d & a_Vector)
{
ASSERT(IsValid());
@@ -1355,6 +1366,22 @@ bool cLuaState::GetStackValue(int a_StackPos, cTrackedRefSharedPtr & a_Ref)
+bool cLuaState::GetStackValue(int a_StackPos, ContiguousByteBuffer & a_Data)
+{
+ size_t Length = 0;
+ const char * const Data = lua_tolstring(m_LuaState, a_StackPos, &Length);
+ if (Data != nullptr)
+ {
+ a_Data.assign(reinterpret_cast<const std::byte *>(Data), Length);
+ return true;
+ }
+ return false;
+}
+
+
+
+
+
bool cLuaState::GetStackValue(int a_StackPos, double & a_ReturnedVal)
{
if (lua_isnumber(m_LuaState, a_StackPos))