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
96e10fff
Commit
96e10fff
authored
May 24, 2013
by
Mangatome
Browse files
Silverlight fixes
parent
feabc83e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Core/NLua/Exceptions/LuaException.cs
View file @
96e10fff
...
...
@@ -24,14 +24,18 @@
* THE SOFTWARE.
*/
using
System
;
#if !SILVERLIGHT
using
System.Runtime.Serialization
;
#endif
namespace
NLua.Exceptions
{
/// <summary>
/// Exceptions thrown by the Lua runtime
/// </summary>
#if !SILVERLIGHT
[
Serializable
]
#endif
public
class
LuaException
:
Exception
{
public
LuaException
()
...
...
@@ -46,8 +50,10 @@ namespace NLua.Exceptions
{
}
#if !SILVERLIGHT
protected
LuaException
(
SerializationInfo
info
,
StreamingContext
context
)
:
base
(
info
,
context
)
{
}
#endif
}
}
\ No newline at end of file
Core/NLua/Exceptions/LuaScriptException.cs
View file @
96e10fff
...
...
@@ -42,7 +42,11 @@ namespace NLua.Exceptions
/// <summary>
/// The position in the script where the exception was triggered.
/// </summary>
#if SILVERLIGHT
public
string
Source
{
get
{
return
source
;
}
}
#else
public
override
string
Source
{
get
{
return
source
;
}
}
#endif
/// <summary>
/// Creates a new Lua-only exception.
...
...
Core/NLua/GenerateEventAssembly/CodeGeneration.cs
View file @
96e10fff
...
...
@@ -51,7 +51,7 @@ namespace NLua
private
static
readonly
CodeGeneration
instance
=
new
CodeGeneration
();
private
AssemblyName
assemblyName
;
#if !MONOTOUCH
#if !MONOTOUCH
&& !SILVERLIGHT
private
Dictionary
<
Type
,
Type
>
eventHandlerCollection
=
new
Dictionary
<
Type
,
Type
>
();
private
Type
eventHandlerParent
=
typeof
(
LuaEventHandler
);
private
Type
delegateParent
=
typeof
(
LuaDelegate
);
...
...
@@ -314,6 +314,8 @@ namespace NLua
{
#if MONOTOUCH
throw
new
NotImplementedException
(
" Emit not available on MonoTouch "
);
#elif SILVERLIGHT
throw
new
NotImplementedException
(
" Emit not available on Silverlight "
);
#else
string
typeName
;
lock
(
this
)
{
...
...
@@ -413,7 +415,7 @@ namespace NLua
returnTypes
=
returnTypesList
.
ToArray
();
}
#if !MONOTOUCH
#if !MONOTOUCH
&& !SILVERLIGHT
/*
* Generates an overriden implementation of method inside myType that delegates
...
...
Core/NLua/Lua.cs
View file @
96e10fff
...
...
@@ -817,9 +817,9 @@ end
LuaLib
.
lua_settop
(
luaState
,
oldTop
);
}
public
List
Dictionary
GetTableDict
(
LuaTable
table
)
public
Dictionary
<
object
,
object
>
GetTableDict
(
LuaTable
table
)
{
var
dict
=
new
List
Dictionary
();
var
dict
=
new
Dictionary
<
object
,
object
>
();
int
oldTop
=
LuaLib
.
lua_gettop
(
luaState
);
translator
.
push
(
luaState
,
table
);
LuaLib
.
lua_pushnil
(
luaState
);
...
...
Core/NLua/LuaLib/LuaTypes.cs
View file @
96e10fff
...
...
@@ -27,7 +27,9 @@
using
System
;
using
System.IO
;
using
System.Runtime.InteropServices
;
#if !SILVERLIGHT
using
System.Runtime.Serialization.Formatters.Binary
;
#endif
using
NLua.Extensions
;
namespace
NLua
...
...
Core/NLua/Metatables.cs
View file @
96e10fff
...
...
@@ -51,7 +51,7 @@ namespace NLua
{
internal
LuaCore
.
lua_CFunction
gcFunction
,
indexFunction
,
newindexFunction
,
baseIndexFunction
,
classIndexFunction
,
classNewindexFunction
,
execDelegateFunction
,
callConstructorFunction
,
toStringFunction
;
private
Hashtable
memberCache
=
new
Hashtable
();
private
Dictionary
<
object
,
object
>
memberCache
=
new
Dictionary
<
object
,
object
>
();
private
ObjectTranslator
translator
;
/*
...
...
@@ -176,7 +176,11 @@ namespace NLua
strrep
=
obj
.
ToString
();
}
#if WINDOWS_PHONE
Debug
.
WriteLine
(
"{0}: ({1}) {2}"
,
i
,
typestr
,
strrep
);
#elif !SILVERLIGHT
Debug
.
Print
(
"{0}: ({1}) {2}"
,
i
,
typestr
,
strrep
);
#endif
}
}
...
...
@@ -470,21 +474,21 @@ namespace NLua
/*
* Checks if a MemberInfo object is cached, returning it or null.
*/
private
object
checkMemberCache
(
Hashtable
memberCache
,
IReflect
objType
,
string
memberName
)
private
object
checkMemberCache
(
Dictionary
<
object
,
object
>
memberCache
,
IReflect
objType
,
string
memberName
)
{
var
members
=
(
Hashtable
)
memberCache
[
objType
];
var
members
=
(
Dictionary
<
object
,
object
>
)
memberCache
[
objType
];
return
!
members
.
IsNull
()
?
members
[
memberName
]
:
null
;
}
/*
* Stores a MemberInfo object in the member cache.
*/
private
void
setMemberCache
(
Hashtable
memberCache
,
IReflect
objType
,
string
memberName
,
object
member
)
private
void
setMemberCache
(
Dictionary
<
object
,
object
>
memberCache
,
IReflect
objType
,
string
memberName
,
object
member
)
{
var
members
=
(
Hashtable
)
memberCache
[
objType
];
var
members
=
(
Dictionary
<
object
,
object
>
)
memberCache
[
objType
];
if
(
members
.
IsNull
())
{
members
=
new
Hashtable
();
members
=
new
Dictionary
<
object
,
object
>
();
memberCache
[
objType
]
=
members
;
}
...
...
@@ -553,9 +557,11 @@ namespace NLua
}
else
translator
.
throwError
(
luaState
,
detailMessage
);
// Pass the original message from trySetMember because it is probably best
}
#if !SILVERLIGHT
}
catch
(
SEHException
)
{
// If we are seeing a C++ exception - this must actually be for Lua's private use. Let it handle it
throw
;
#endif
}
catch
(
Exception
e
)
{
ThrowError
(
luaState
,
e
);
}
...
...
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