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
12b22866
Commit
12b22866
authored
Sep 17, 2013
by
Vinicius Jarina
Browse files
Fix: convert string to char[].
parent
079b7966
Changes
1
Show whitespace changes
Inline
Side-by-side
Core/NLua/CheckType.cs
View file @
12b22866
...
...
@@ -73,6 +73,7 @@ namespace NLua
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
decimal
)),
new
ExtractValue
(
GetAsDecimal
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
bool
)),
new
ExtractValue
(
GetAsBoolean
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
string
)),
new
ExtractValue
(
GetAsString
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
char
[])),
new
ExtractValue
(
GetAsCharArray
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
LuaFunction
)),
new
ExtractValue
(
GetAsFunction
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
LuaTable
)),
new
ExtractValue
(
GetAsTable
));
extractValues
.
Add
(
GetExtractDictionaryKey
(
typeof
(
LuaUserData
)),
new
ExtractValue
(
GetAsUserdata
));
...
...
@@ -136,7 +137,7 @@ namespace NLua
if
(
paramType
==
typeof
(
bool
))
{
if
(
LuaLib
.
LuaIsBoolean
(
luaState
,
stackPos
))
return
extractValues
[
extractKey
];
}
else
if
(
paramType
==
typeof
(
string
))
{
}
else
if
(
paramType
==
typeof
(
string
)
||
paramType
==
typeof
(
char
[])
)
{
if
(
LuaLib
.
LuaIsString
(
luaState
,
stackPos
))
return
extractValues
[
extractKey
];
else
if
(
luatype
==
LuaTypes
.
Nil
)
...
...
@@ -304,6 +305,17 @@ namespace NLua
return
LuaLib
.
LuaToBoolean
(
luaState
,
stackPos
);
}
private
object
GetAsCharArray
(
LuaState
luaState
,
int
stackPos
)
{
string
retVal
=
LuaLib
.
LuaToString
(
luaState
,
stackPos
).
ToString
();
if
(
string
.
IsNullOrEmpty
(
retVal
)
&&
!
LuaLib
.
LuaIsString
(
luaState
,
stackPos
))
return
null
;
return
retVal
.
ToCharArray
();
}
private
object
GetAsString
(
LuaState
luaState
,
int
stackPos
)
{
string
retVal
=
LuaLib
.
LuaToString
(
luaState
,
stackPos
).
ToString
();
...
...
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