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
db21506a
Commit
db21506a
authored
Oct 05, 2021
by
Kagamia
Committed by
Vinicius Jarina
Oct 05, 2021
Browse files
Fix passing bytearray from lua.
parent
4a6440e9
Changes
2
Show whitespace changes
Inline
Side-by-side
src/CheckType.cs
View file @
db21506a
...
@@ -167,12 +167,10 @@ namespace NLua
...
@@ -167,12 +167,10 @@ namespace NLua
else
else
return
null
;
return
null
;
}
}
else
{
object
netObj
=
_translator
.
GetNetObject
(
luaState
,
stackPos
);
object
obj
=
_translator
.
GetNetObject
(
luaState
,
stackPos
);
if
(
netObj
!=
null
&&
paramType
.
IsInstanceOfType
(
netObj
))
if
(
obj
!=
null
&&
paramType
.
IsInstanceOfType
(
obj
))
return
_extractNetObject
;
return
_extractNetObject
;
}
return
null
;
return
null
;
}
}
...
...
tests/src/LuaTests.cs
View file @
db21506a
...
@@ -2778,6 +2778,29 @@ namespace NLuaTest
...
@@ -2778,6 +2778,29 @@ namespace NLuaTest
}
}
}
}
[
Test
]
public
void
RawByteArrayParameter
()
{
using
(
var
lua
=
new
Lua
())
{
lua
.
LoadCLRPackage
();
lua
[
"WriteBinary"
]
=
(
Action
<
byte
[
]>
)
WriteBinary
;
lua
.
DoString
(
@"
import 'System'
local value = Byte[8]
value[0] = 1
value[1] = 2
value[2] = 3
value[3] = 0x3f
value[4] = 0x40
value[5] = 0xff
value[6] = 0xf3
value[7] = 0x9f
WriteBinary (value);
"
);
}
}
Entity
myEntity
;
Entity
myEntity
;
void
OnMyClicked
(
object
sender
,
EventArgs
args
)
void
OnMyClicked
(
object
sender
,
EventArgs
args
)
...
...
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