Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
1414ef61
Commit
1414ef61
authored
May 18, 2013
by
Vinicius Jarina
Browse files
Merge pull request #5 from charlenni/master
Changed lua_tostring to use ToString(strlen) instead of ToString()
parents
d3e5dc98
e8e06157
Changes
1
Hide whitespace changes
Inline
Side-by-side
Core/NLua/LuaLib/LuaLib.cs
View file @
1414ef61
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment