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
1aaf1544
Commit
1aaf1544
authored
Nov 20, 2014
by
Vinicius Jarina
Browse files
Migration to Unified Xamarin.iOS
parent
9dc02291
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
ConsoleTest/Program.cs
View file @
1aaf1544
...
...
@@ -10,16 +10,19 @@ using NLuaTest;
namespace
ConsoleTest
{
public
class
Program
{
static
void
Main
(
string
[]
args
)
{
using
(
var
l
=
new
Lua
())
{
Action
c
=
()
=>
{
Console
.
WriteLine
(
"Ola"
);
};
l
[
"d"
]
=
c
;
l
.
DoString
(
" d () "
);
l
.
LoadCLRPackage
();
l
.
DoString
(
" import ('ConsoleTest') "
);
l
.
DoString
(
@"
p=parameter()
r1 = testClass2.read(p) -- is not working. it is also not working if the method in base class has two parameters instead of one
r2 = testClass2.read(1) -- is working
"
);
}
}
}
...
...
KeraLua
@
e31a4830
Compare
eff38fd1
...
e31a4830
Subproject commit e
ff38fd1739ef2738d912d6872a2d4315d07af21
Subproject commit e
31a48301af5c69a05766477e5d8c19928514a13
KopiLua
@
2c66160f
Compare
2f0dfdcc
...
2c66160f
Subproject commit 2
f0dfdcc50acca3e88afa6ef5cc5ad97f142e57a
Subproject commit 2
c66160f82469cf9aa73feb4a834dc31aa1dbc85
Core/NLua/Lua.cs
View file @
1aaf1544
This diff is collapsed.
Click to expand it.
Core/NLua/Metatables.cs
View file @
1aaf1544
...
...
@@ -32,6 +32,7 @@ using System.Collections.Generic;
using
System.Runtime.InteropServices
;
using
NLua.Method
;
using
NLua.Extensions
;
using
ObjCRuntime
;
namespace
NLua
{
...
...
@@ -126,7 +127,7 @@ namespace NLua
* __call metafunction of CLR delegates, retrieves and calls the delegate.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
RunFunctionDelegate
(
LuaState
luaState
)
{
...
...
@@ -145,7 +146,7 @@ namespace NLua
* __gc metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
CollectObject
(
LuaState
luaState
)
{
...
...
@@ -167,7 +168,7 @@ namespace NLua
* __tostring metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
ToStringLua
(
LuaState
luaState
)
{
...
...
@@ -192,7 +193,7 @@ namespace NLua
* __add metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
AddLua
(
LuaState
luaState
)
{
...
...
@@ -204,7 +205,7 @@ namespace NLua
* __sub metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
SubtractLua
(
LuaState
luaState
)
{
...
...
@@ -216,7 +217,7 @@ namespace NLua
* __mul metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
MultiplyLua
(
LuaState
luaState
)
{
...
...
@@ -228,7 +229,7 @@ namespace NLua
* __div metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
DivideLua
(
LuaState
luaState
)
{
...
...
@@ -240,7 +241,7 @@ namespace NLua
* __mod metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
ModLua
(
LuaState
luaState
)
{
...
...
@@ -252,7 +253,7 @@ namespace NLua
* __unm metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
UnaryNegationLua
(
LuaState
luaState
)
{
...
...
@@ -288,7 +289,7 @@ namespace NLua
* __eq metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
EqualLua
(
LuaState
luaState
)
{
...
...
@@ -300,7 +301,7 @@ namespace NLua
* __lt metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
LessThanLua
(
LuaState
luaState
)
{
...
...
@@ -312,7 +313,7 @@ namespace NLua
* __le metafunction of CLR objects.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
static
int
LessThanOrEqualLua
(
LuaState
luaState
)
{
...
...
@@ -365,7 +366,7 @@ namespace NLua
* If the member does not exist returns nil.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
GetMethod
(
LuaState
luaState
)
{
...
...
@@ -474,7 +475,7 @@ namespace NLua
* Adds a prefix to the method name to call the base version of the method.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
GetBaseMethod
(
LuaState
luaState
)
{
...
...
@@ -764,7 +765,7 @@ namespace NLua
* and error if the assignment is invalid.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
SetFieldOrProperty
(
LuaState
luaState
)
{
...
...
@@ -946,7 +947,7 @@ namespace NLua
* __index metafunction of type references, works on static members.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
GetClassMethod
(
LuaState
luaState
)
{
...
...
@@ -987,7 +988,7 @@ namespace NLua
* __newindex function of type references, works on static members.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
SetClassFieldOrProperty
(
LuaState
luaState
)
{
...
...
@@ -1014,7 +1015,7 @@ namespace NLua
* __call metafunction of Delegates.
*/
#
if
MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#
endif
static
int
CallDelegate
(
LuaState
luaState
)
{
...
...
@@ -1068,7 +1069,7 @@ namespace NLua
* generates an exception.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
CallConstructor
(
LuaState
luaState
)
{
...
...
Core/NLua/NLua.iOS.csproj
View file @
1aaf1544
...
...
@@ -3,14 +3,14 @@
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
10.0.0
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{7064B157-DD57-4828-94C5-CA149B25CB40}
</ProjectGuid>
<ProjectTypeGuids>
{
6BC8ED88-2882-458C-8E55-DFD12B67127B
};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<ProjectTypeGuids>
{
FEACFBD2-3405-455C-9665-78FE426C6842
};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<OutputType>
Library
</OutputType>
<RootNamespace>
NLua.iOS
</RootNamespace>
<IPhoneResourcePrefix>
Resources
</IPhoneResourcePrefix>
<AssemblyName>
NLua.iOS
</AssemblyName>
<TargetFrameworkIdentifier>
Xamarin.iOS
</TargetFrameworkIdentifier>
<TargetFrameworkVersion>
v1.0
</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
True
</DebugSymbols>
...
...
@@ -36,9 +36,8 @@
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"
monotouch
"
/>
<Reference
Include=
"
Xamarin.iOS
"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets"
/>
<ItemGroup>
<Folder
Include=
"GenerateEventAssembly\ios\"
/>
</ItemGroup>
...
...
@@ -92,4 +91,5 @@
<Name>
KeraLua.iOS
</Name>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets"
/>
</Project>
\ No newline at end of file
Core/NLua/ObjectTranslator.cs
View file @
1aaf1544
...
...
@@ -32,6 +32,7 @@ using System.Collections.Generic;
using
NLua.Method
;
using
NLua.Exceptions
;
using
NLua.Extensions
;
using
ObjCRuntime
;
namespace
NLua
{
...
...
@@ -259,7 +260,7 @@ namespace NLua
* if the assembly is not found.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
LoadAssembly
(
LuaState
luaState
)
{
...
...
@@ -346,7 +347,7 @@ namespace NLua
* type is not found.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
ImportType
(
LuaState
luaState
)
{
...
...
@@ -373,7 +374,7 @@ namespace NLua
* type passed as second argument in the stack.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
RegisterTable
(
LuaState
luaState
)
{
...
...
@@ -424,7 +425,7 @@ namespace NLua
* base field, freeing the created object for garbage-collection
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
UnregisterTable
(
LuaState
luaState
)
{
...
...
@@ -468,7 +469,7 @@ namespace NLua
* if no matching method is not found.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
GetMethodSignature
(
LuaState
luaState
)
{
...
...
@@ -520,7 +521,7 @@ namespace NLua
* if no matching constructor is found.
*/
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
GetConstructorSignature
(
LuaState
luaState
)
{
...
...
@@ -998,7 +999,7 @@ namespace NLua
}
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
CType
(
LuaState
luaState
)
{
...
...
@@ -1017,7 +1018,7 @@ namespace NLua
}
#if MONOTOUCH
[
MonoTouch
.
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
[
MonoPInvokeCallback
(
typeof
(
LuaNativeFunction
))]
#endif
private
static
int
EnumFromInt
(
LuaState
luaState
)
{
...
...
NLua.Net45.sln
View file @
1aaf1544
This diff is collapsed.
Click to expand it.
NLuaTest/LoadFileTests.cs
View file @
1aaf1544
...
...
@@ -14,7 +14,7 @@ using NUnit.Framework;
#endif
#if MONOTOUCH
using
MonoTouch.
Foundation
;
using
Foundation
;
using
MonoTouch
;
#endif
...
...
ios/NLuaTestsiOS/Main.cs
View file @
1aaf1544
...
...
@@ -2,8 +2,8 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
using
MonoTouch.
Foundation
;
using
MonoTouch.
UIKit
;
using
Foundation
;
using
UIKit
;
namespace
NLuaTestsiOS
{
...
...
ios/NLuaTestsiOS/NLuaTest.csproj
View file @
1aaf1544
...
...
@@ -4,11 +4,13 @@
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
iPhoneSimulator
</Platform>
<ProjectGuid>
{2DC0E43A-21B8-41FF-8793-60AB50350977}
</ProjectGuid>
<ProjectTypeGuids>
{
6BC8ED88-2882-458C-8E55-DFD12B67127B
};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<ProjectTypeGuids>
{
FEACFBD2-3405-455C-9665-78FE426C6842
};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<OutputType>
Exe
</OutputType>
<RootNamespace>
NLuaTest
</RootNamespace>
<IPhoneResourcePrefix>
Resources
</IPhoneResourcePrefix>
<AssemblyName>
NLuaTest
</AssemblyName>
<TargetFrameworkIdentifier>
Xamarin.iOS
</TargetFrameworkIdentifier>
<TargetFrameworkVersion>
v1.0
</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "
>
<DebugSymbols>
True
</DebugSymbols>
...
...
@@ -107,9 +109,9 @@
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"monotouch"
/>
<Reference
Include=
"MonoTouch.NUnitLite"
/>
<Reference
Include=
"System.Numerics"
/>
<Reference
Include=
"Xamarin.iOS"
/>
</ItemGroup>
<ItemGroup
/>
<ItemGroup>
...
...
@@ -138,7 +140,6 @@
<Link>
LoadFileTests.cs
</Link>
</Compile>
</ItemGroup>
<Import
Project=
"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets"
/>
<Import
Project=
"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets"
/>
<ItemGroup>
<ProjectReference
Include=
"..\..\Core\NLua\NLua.iOS.csproj"
>
...
...
ios/NLuaTestsiOS/NLuaTests.cs
View file @
1aaf1544
...
...
@@ -5,7 +5,7 @@ using NLua;
using
NLuaTest.Mock
;
#if MONOTOUCH
using
MonoTouch.
Foundation
;
using
Foundation
;
using
MonoTouch
;
#endif
...
...
@@ -42,7 +42,7 @@ namespace NLuaTest
using
(
Lua
lua
=
new
Lua
())
{
lua
.
LoadCLRPackage
();
lua
.
DoString
(
"import ('
monotouch', 'MonoTouch.
Foundation') "
);
lua
.
DoString
(
"import ('
Xamarin.iOS', '
Foundation') "
);
lua
.
DoString
(
"testURL = NSUrl('http://nlua.org/?query=param')"
);
lua
.
DoString
(
"host = testURL.Host"
);
...
...
ios/NLuaTestsiOS/UnitTestAppDelegate.cs
View file @
1aaf1544
...
...
@@ -2,8 +2,8 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
using
MonoTouch.
Foundation
;
using
MonoTouch.
UIKit
;
using
Foundation
;
using
UIKit
;
using
MonoTouch.NUnit.UI
;
namespace
NLuaTestsiOS
...
...
tests/Core.cs
View file @
1aaf1544
...
...
@@ -2,20 +2,20 @@
using
System
;
using
NLua
;
using
NLua.Exceptions
;
using
System.IO
;
#if WINDOWS_PHONE
using
Microsoft.VisualStudio.TestPlatform.UnitTestFramework
;
using
SetUp
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestInitializeAttribute
;
using
TearDown
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestCleanupAttribute
;
using
TestFixture
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestClassAttribute
;
using
Test
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestMethodAttribute
;
#else
using
NUnit.Framework
;
using
System.IO
;
#if WINDOWS_PHONE
using
Microsoft.VisualStudio.TestPlatform.UnitTestFramework
;
using
SetUp
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestInitializeAttribute
;
using
TearDown
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestCleanupAttribute
;
using
TestFixture
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestClassAttribute
;
using
Test
=
Microsoft
.
VisualStudio
.
TestPlatform
.
UnitTestFramework
.
TestMethodAttribute
;
#else
using
NUnit.Framework
;
#endif
#if MONOTOUCH
using
MonoTouch.
Foundation
;
using
Foundation
;
#endif
namespace
NLuaTest
...
...
@@ -48,8 +48,8 @@ namespace NLuaTest
[
SetUp
]
public
void
Setup
()
{
lua
=
new
Lua
();
lua
.
RegisterFunction
(
"WriteLineString"
,
typeof
(
Console
).
GetMethod
(
"WriteLine"
,
new
Type
[]
{
typeof
(
String
)
}));
lua
=
new
Lua
();
lua
.
RegisterFunction
(
"WriteLineString"
,
typeof
(
Console
).
GetMethod
(
"WriteLine"
,
new
Type
[]
{
typeof
(
String
)
}));
lua
.
DoString
(
@"
function print (param)
...
...
@@ -77,7 +77,7 @@ namespace NLuaTest
TestLuaFile
(
"cf"
);
}
[
Test
]
[
Test
]
[
Ignore
]
public
void
Env
()
{
...
...
@@ -108,7 +108,7 @@ namespace NLuaTest
TestLuaFile
(
"printf"
);
}
[
Test
]
[
Test
]
[
Ignore
]
public
void
ReadOnly
()
{
...
...
tests/LuaTests.cs
View file @
1aaf1544
...
...
@@ -7,7 +7,7 @@ using System.Threading;
using
NLua
;
using
NLua.Exceptions
;
#if MONOTOUCH
using
MonoTouch.
Foundation
;
using
Foundation
;
#endif
#if WINDOWS_PHONE
...
...
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