Commit 1414ef61 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Merge pull request #5 from charlenni/master

Changed lua_tostring to use ToString(strlen) instead of ToString()
parents d3e5dc98 e8e06157
......@@ -334,7 +334,13 @@ namespace NLua
return string.Format ("{0}", lua_tonumber (luaState, index));
else if (t == LuaTypes.String) {
uint strlen;
return LuaCore.lua_tolstring (luaState, index, out strlen).ToString ();
// Changed 2013-05-18 by Dirk Weltz
// Changed because binary chunks, which are also transfered as strings
// get corrupted by conversion to strings because of the encoding.
// So we use the ToString method with string length, so it could be checked,
// if string is a binary chunk and if, could transfered to string without
// encoding.
return LuaCore.lua_tolstring (luaState, index, out strlen).ToString ((int)strlen);
} else if (t == LuaTypes.Nil)
return null; // treat lua nulls to as C# nulls
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment