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
6336b46a
Commit
6336b46a
authored
Dec 01, 2011
by
Megax
Browse files
bridge from LuaInterface(capresti) to LuaInterface (megax) part 2
parent
52119866
Changes
53
Expand all
Hide whitespace changes
Inline
Side-by-side
luainterface/src/LuaInterface.Test/test.lua
deleted
100644 → 0
View file @
52119866
width
=
100
height
=
200
message
=
"Hello World!"
color
=
{
r
=
100
,
g
=
20
,
b
=
50
}
tree
=
{
branch1
=
{
leaf1
=
10
,
leaf2
=
"leaf2"
},
leaf3
=
"leaf3"
}
function
func
(
x
,
y
)
return
x
,
x
+
y
end
luainterface/src/LuaInterface.net35/LuaInterface.net35.csproj
deleted
100644 → 0
View file @
52119866
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
8.0.30703
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{817FF371-DB5F-4382-8E68-F1E569D20A81}
</ProjectGuid>
<OutputType>
Library
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
LuaInterface
</RootNamespace>
<AssemblyName>
LuaInterface
</AssemblyName>
<TargetFrameworkVersion>
v3.5
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<TargetFrameworkProfile
/>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"lua51"
>
<HintPath>
..\..\lib\lua51\net35\lua51.dll
</HintPath>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Data.DataSetExtensions"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"..\LuaInterface\CheckType.cs"
>
<Link>
CheckType.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\GenerateEventAssembly.cs"
>
<Link>
GenerateEventAssembly.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\Lua.cs"
>
<Link>
Lua.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaBase.cs"
>
<Link>
LuaBase.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaException.cs"
>
<Link>
LuaException.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaFunction.cs"
>
<Link>
LuaFunction.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaGlobalAttribute.cs"
>
<Link>
LuaGlobalAttribute.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaHideAttribute.cs"
>
<Link>
LuaHideAttribute.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaRegistrationHelper.cs"
>
<Link>
LuaRegistrationHelper.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaScriptException.cs"
>
<Link>
LuaScriptException.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaTable.cs"
>
<Link>
LuaTable.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\LuaUserData.cs"
>
<Link>
LuaUserData.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\Metatables.cs"
>
<Link>
Metatables.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\MethodWrapper.cs"
>
<Link>
MethodWrapper.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\ObjectTranslator.cs"
>
<Link>
ObjectTranslator.cs
</Link>
</Compile>
<Compile
Include=
"..\LuaInterface\ProxyType.cs"
>
<Link>
ProxyType.cs
</Link>
</Compile>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<ProjectExtensions>
<VisualStudio>
<UserProperties
ProjectLinkerExcludeFilter=
"\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$"
/>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
luainterface/src/LuaInterface.net35/Properties/AssemblyInfo.cs
deleted
100644 → 0
View file @
52119866
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[
assembly
:
AssemblyTitle
(
"LuaInterface"
)]
[
assembly
:
AssemblyDescription
(
"Bridge between the Lua runtime and the CLR"
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"LuaInterface"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright 2003-2008 Fabio Mascarenhas, Kevin Hester"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[
assembly
:
ComVisible
(
false
)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[
assembly
:
Guid
(
"ccd6bdad-dddd-4f27-ba91-5a5f4e200239"
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"2.0.4.0"
)]
[
assembly
:
AssemblyFileVersion
(
"2.0.4.0"
)]
luainterface/src/LuaRunner/LuaNetRunner.cs
deleted
100644 → 0
View file @
52119866
using
System
;
using
LuaInterface
;
using
System.Threading
;
/*
* Application to run Lua scripts that can use LuaInterface
* from the console
*
* Author: Fabio Mascarenhas
* Version: 1.0
*/
namespace
LuaRunner
{
public
class
LuaNetRunner
{
/*
* Runs the Lua script passed as the first command-line argument.
* It passed all the command-line arguments to the script.
*/
[
STAThread
]
// steffenj: testluaform.lua "Load" button complained with an exception that STAThread was missing
public
static
void
Main
(
string
[]
args
)
{
if
(
args
.
Length
>
0
)
{
// For attaching from the debugger
// Thread.Sleep(20000);
using
(
Lua
lua
=
new
Lua
())
{
//lua.OpenLibs(); // steffenj: Lua 5.1.1 API change (all libs already opened in Lua constructor!)
lua
.
NewTable
(
"arg"
);
LuaTable
argc
=
(
LuaTable
)
lua
[
"arg"
];
argc
[-
1
]
=
"LuaRunner"
;
argc
[
0
]
=
args
[
0
];
for
(
int
i
=
1
;
i
<
args
.
Length
;
i
++)
{
argc
[
i
]
=
args
[
i
];
}
argc
[
"n"
]
=
args
.
Length
-
1
;
try
{
//Console.WriteLine("DoFile(" + args[0] + ");");
lua
.
DoFile
(
args
[
0
]);
}
catch
(
Exception
e
)
{
// steffenj: BEGIN error message improved, output is now in decending order of importance (message, where, stacktrace)
// limit size of strack traceback message to roughly 1 console screen height
string
trace
=
e
.
StackTrace
;
if
(
e
.
StackTrace
.
Length
>
1300
)
trace
=
e
.
StackTrace
.
Substring
(
0
,
1300
)
+
" [...] (traceback cut short)"
;
Console
.
WriteLine
();
Console
.
WriteLine
(
e
.
Message
);
Console
.
WriteLine
(
e
.
Source
+
" raised a "
+
e
.
GetType
().
ToString
());
Console
.
WriteLine
(
trace
);
// wait for keypress if there is an error
Console
.
ReadKey
();
// steffenj: END error message improved
}
}
}
else
{
Console
.
WriteLine
(
"LuaRunner -- runs Lua scripts with CLR access"
);
Console
.
WriteLine
(
"Usage: luarunner <script.lua> [{<arg>}]"
);
}
}
}
}
luainterface/src/LuaRunner/LuaRunner.csproj
deleted
100644 → 0
View file @
52119866
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion=
"4.0"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.21022
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
LuaRunner
</RootNamespace>
<AssemblyName>
LuaRunner
</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>
3.5
</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<PublishUrl>
publish\
</PublishUrl>
<Install>
true
</Install>
<InstallFrom>
Disk
</InstallFrom>
<UpdateEnabled>
false
</UpdateEnabled>
<UpdateMode>
Foreground
</UpdateMode>
<UpdateInterval>
7
</UpdateInterval>
<UpdateIntervalUnits>
Days
</UpdateIntervalUnits>
<UpdatePeriodically>
false
</UpdatePeriodically>
<UpdateRequired>
false
</UpdateRequired>
<MapFileExtensions>
true
</MapFileExtensions>
<ApplicationRevision>
0
</ApplicationRevision>
<ApplicationVersion>
1.0.0.%2a
</ApplicationVersion>
<IsWebBootstrapper>
false
</IsWebBootstrapper>
<UseApplicationTrust>
false
</UseApplicationTrust>
<BootstrapperEnabled>
true
</BootstrapperEnabled>
<TargetFrameworkProfile
/>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\..\..\Built\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
x86
</PlatformTarget>
<CodeAnalysisRuleSet>
AllRules.ruleset
</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
..\..\..\Built\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
x86
</PlatformTarget>
<CodeAnalysisRuleSet>
AllRules.ruleset
</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"LuaNetRunner.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\LuaInterface\LuaInterface.csproj"
>
<Project>
{F55CABBB-4108-4A39-94E1-581FD46DC021}
</Project>
<Name>
LuaInterface
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage
Include=
"Microsoft.Net.Client.3.5"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.5 SP1 Client Profile
</ProductName>
<Install>
false
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Net.Framework.3.5.SP1"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.5 SP1
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Windows.Installer.3.1"
>
<Visible>
False
</Visible>
<ProductName>
Windows Installer 3.1
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None
Include=
"app.config"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildBinPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
luainterface/src/LuaRunner/Properties/AssemblyInfo.cs
deleted
100644 → 0
View file @
52119866
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[
assembly
:
AssemblyTitle
(
"LuaRunner"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"LuaRunner"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © 2006"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[
assembly
:
ComVisible
(
false
)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[
assembly
:
Guid
(
"0db73438-fb76-4991-b61d-3c072d340154"
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[
assembly
:
AssemblyVersion
(
"1.5.2"
)]
[
assembly
:
AssemblyFileVersion
(
"1.5.2"
)]
luainterface/src/TestLuaInterface/AssemblyInfo.cs
deleted
100644 → 0
View file @
52119866
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[
assembly
:
AssemblyTitle
(
""
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
""
)]
[
assembly
:
AssemblyCopyright
(
""
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.0.*"
)]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[
assembly
:
AssemblyDelaySign
(
false
)]
[
assembly
:
AssemblyKeyFile
(
""
)]
[
assembly
:
AssemblyKeyName
(
""
)]
luainterface/src/TestLuaInterface/Entity.cs
deleted
100644 → 0
View file @
52119866
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
LuaInterface.Tests
{
public
class
Entity
{
public
event
EventHandler
<
EventArgs
>
Clicked
;
protected
virtual
void
OnEntityClicked
(
EventArgs
e
)
{
EventHandler
<
EventArgs
>
handler
=
Clicked
;
if
(
handler
!=
null
)
{
// Use the () operator to raise the event.
handler
(
this
,
e
);
}
}
public
Entity
()
{
}
public
void
Click
()
{
OnEntityClicked
(
new
EventArgs
());
}
}
}
luainterface/src/TestLuaInterface/Readme.txt
deleted
100644 → 0
View file @
52119866
Note that this project should be considered deprecated. While I'm leaving it here for the moment, it will likely be removed from the repository in future.
\ No newline at end of file
luainterface/src/TestLuaInterface/TestLua.cs
deleted
100644 → 0
View file @
52119866
namespace
LuaInterface.Tests
{
using
System
;
using
LuaInterface
;
using
System.Threading
;
using
System.Diagnostics
;
using
System.Reflection
;
/*
* Delegates used for testing Lua function -> delegate translation
*/
public
delegate
int
TestDelegate1
(
int
a
,
int
b
);
public
delegate
int
TestDelegate2
(
int
a
,
out
int
b
);
public
delegate
void
TestDelegate3
(
int
a
,
ref
int
b
);
public
delegate
TestClass
TestDelegate4
(
int
a
,
int
b
);
public
delegate
int
TestDelegate5
(
TestClass
a
,
TestClass
b
);
public
delegate
int
TestDelegate6
(
int
a
,
out
TestClass
b
);
public
delegate
void
TestDelegate7
(
int
a
,
ref
TestClass
b
);
/*
* Interface used for testing Lua table -> interface translation
*/
public
interface
ITest
{
int
intProp
{
get
;
set
;
}
TestClass
refProp
{
get
;
set
;
}
int
test1
(
int
a
,
int
b
);
int
test2
(
int
a
,
out
int
b
);
void
test3
(
int
a
,
ref
int
b
);
TestClass
test4
(
int
a
,
int
b
);
int
test5
(
TestClass
a
,
TestClass
b
);
int
test6
(
int
a
,
out
TestClass
b
);
void
test7
(
int
a
,
ref
TestClass
b
);
}
public
interface
IFoo1
{
int
foo
();
}
public
interface
IFoo2
{
int
foo
();
}
class
MyClass
{
public
int
Func1
()
{
return
1
;}
}
/// <summary>
/// Use to test threading
/// </summary>
class
DoWorkClass
{
private
object
_Lock
=
new
object
();
public
void
DoWork
()
{
//lock (_Lock)
//{
//simulate work by sleeping
//Console.WriteLine("Started to do work on thread: " + Thread.CurrentThread.ManagedThreadId);
Thread
.
Sleep
(
new
Random
().
Next
(
0
,
1000
));
//Console.WriteLine("Finished work on thread: " + Thread.CurrentThread.ManagedThreadId);
//}
}
}
/// <summary>
/// test structure passing
/// </summary>
public
struct
TestStruct
{
public
TestStruct
(
float
val
)
{
v
=
val
;
}
public
float
v
;
public
float
val
{
get
{
return
v
;
}
set
{
v
=
value
;
}
}
}
/// <summary>
/// Generic class with generic and non-generic methods
/// </summary>
/// <typeparam name="T"></typeparam>
public
class
TestClassGeneric
<
T
>
{
private
object
_PassedValue
;
private
bool
_RegularMethodSuccess
;
public
bool
RegularMethodSuccess
{
get
{
return
_RegularMethodSuccess
;
}
}
private
bool
_GenericMethodSuccess
;
public
bool
GenericMethodSuccess
{
get
{
return
_GenericMethodSuccess
;
}
}
public
void
GenericMethod
(
T
value
)
{
_PassedValue
=
value
;
_GenericMethodSuccess
=
true
;
}
public
void
RegularMethod
()
{
_RegularMethodSuccess
=
true
;
}
/// <summary>
/// Returns true if the generic method was successfully passed a matching value
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public
bool
Validate
(
T
value
)
{
return
value
.
Equals
(
_PassedValue
);
}
}
/// <summary>
/// Normal class containing a generic method
/// </summary>
public
class
TestClassWithGenericMethod
{
private
object
_PassedValue
;
public
object
PassedValue
{
get
{
return
_PassedValue
;
}
}
private
bool
_GenericMethodSuccess
;
public
bool
GenericMethodSuccess
{
get
{
return
_GenericMethodSuccess
;
}
}
public
void
GenericMethod
<
T
>(
T
value
)
{
_PassedValue
=
value
;
_GenericMethodSuccess
=
true
;
}
internal
bool
Validate
<
T
>(
T
value
)
{
return
value
.
Equals
(
_PassedValue
);
}
}
/*
* Sample class used in several test cases to check if
* Lua scripts are accessing objects correctly
*/
public
class
TestClass
:
IFoo1
,
IFoo2
{
public
int
val
;
private
string
strVal
;
public
TestClass
()
{
val
=
0
;
}
public
TestClass
(
int
val
)
{
this
.
val
=
val
;
}
public
TestClass
(
string
val
)
{
this
.
strVal
=
val
;
}
public
static
TestClass
makeFromString
(
String
str
)
{
return
new
TestClass
(
str
);
}
bool
?
nb2
=
null
;
public
bool
?
NullableBool
{
get
{
return
nb2
;
}
set
{
nb2
=
value
;
}
}
TestStruct
s
=
new
TestStruct
();
public
TestStruct
Struct
{
get
{
return
s
;
}
set
{
s
=
(
TestStruct
)
value
;
}
}
public
int
testval
{
get
{
return
this
.
val
;
}
set
{
this
.
val
=
value
;
}
}
public
int
this
[
int
index
]
{
get
{
return
1
;
}
set
{
}
}
public
int
this
[
string
index
]
{
get
{
return
1
;
}
set
{
}
}
public
int
sum
(
int
x
,
int
y
)
{
return
x
+
y
;
}
public
void
setVal
(
int
newVal
)
{
val
=
newVal
;
}
public
void
setVal
(
string
newVal
)
{
strVal
=
newVal
;
}
public
int
getVal
()
{
return
val
;
}
public
string
getStrVal
()
{
return
strVal
;
}
public
int
outVal
(
out
int
val
)
{
val
=
5
;
return
3
;
}
public
int
outVal
(
out
int
val
,
int
val2
)
{
val
=
5
;
return
val2
;
}
public
int
outVal
(
int
val
,
ref
int
val2
)
{
val2
=
val
+
val2
;
return
val
;
}
public
int
callDelegate1
(
TestDelegate1
del
)
{
return
del
(
2
,
3
);
}
public
int
callDelegate2
(
TestDelegate2
del
)
{
int
a
=
3
;
int
b
=
del
(
2
,
out
a
);
return
a
+
b
;
}
public
int
callDelegate3
(
TestDelegate3
del
)
{
int
a
=
3
;
del
(
2
,
ref
a
);
//Console.WriteLine(a);
return
a
;
}
public
int
callDelegate4
(
TestDelegate4
del
)
{
return
del
(
2
,
3
).
testval
;
}
public
int
callDelegate5
(
TestDelegate5
del
)
{
return
del
(
new
TestClass
(
2
),
new
TestClass
(
3
));
}
public
int
callDelegate6
(
TestDelegate6
del
)
{
TestClass
test
=
new
TestClass
();
int
a
=
del
(
2
,
out
test
);
return
a
+
test
.
testval
;
}
public
int
callDelegate7
(
TestDelegate7
del
)
{
TestClass
test
=
new
TestClass
(
3
);
del
(
2
,
ref
test
);
return
test
.
testval
;
}
public
int
callInterface1
(
ITest
itest
)
{
return
itest
.
test1
(
2
,
3
);
}
public
int
callInterface2
(
ITest
itest
)
{
int
a
=
3
;
int
b
=
itest
.
test2
(
2
,
out
a
);
return
a
+
b
;
}
public
int
callInterface3
(
ITest
itest
)
{
int
a
=
3
;
itest
.
test3
(
2
,
ref
a
);
//Console.WriteLine(a);
return
a
;
}
public
int
callInterface4
(
ITest
itest
)
{
return
itest
.
test4
(
2
,
3
).
testval
;
}
public
int
callInterface5
(
ITest
itest
)
{
return
itest
.
test5
(
new
TestClass
(
2
),
new
TestClass
(
3
));
}
public
int
callInterface6
(
ITest
itest
)
{
TestClass
test
=
new
TestClass
();
int
a
=
itest
.
test6
(
2
,
out
test
);
return
a
+
test
.
testval
;
}
public
int
callInterface7
(
ITest
itest
)
{
TestClass
test
=
new
TestClass
(
3
);
itest
.
test7
(
2
,
ref
test
);
return
test
.
testval
;
}
public
int
callInterface8
(
ITest
itest
)
{
itest
.
intProp
=
3
;
return
itest
.
intProp
;
}
public
int
callInterface9
(
ITest
itest
)
{
itest
.
refProp
=
new
TestClass
(
3
);
return
itest
.
refProp
.
testval
;
}
public
void
exceptionMethod
()
{
throw
new
Exception
(
"exception test"
);
}
public
virtual
int
overridableMethod
(
int
x
,
int
y
)
{
return
x
+
y
;
}
public
static
int
callOverridable
(
TestClass
test
,
int
x
,
int
y
)
{
return
test
.
overridableMethod
(
x
,
y
);
}
int
IFoo1
.
foo
()
{
return
3
;
}
public
int
foo
()
{
return
5
;
}
private
void
_PrivateMethod
()
{
Console
.
WriteLine
(
"Private method called"
);
}
public
void
MethodOverload
()
{
Console
.
WriteLine
(
"Method with no params"
);
}
public
void
MethodOverload
(
TestClass
testClass
)
{
Console
.
WriteLine
(
"Method with testclass param"
);
}
public
void
MethodOverload
(
int
i
,
int
j
,
int
k
)
{
Console
.
WriteLine
(
"Overload without out param: "
+
i
+
", "
+
j
+
", "
+
k
);
}
public
void
MethodOverload
(
int
i
,
int
j
,
out
int
k
)
{
k
=
5
;
Console
.
WriteLine
(
"Overload with out param"
+
i
+
", "
+
j
);
}
}
}
\ No newline at end of file
luainterface/src/TestLuaInterface/TestLuaInterface.cs
deleted
100644 → 0
View file @
52119866
This diff is collapsed.
Click to expand it.
luainterface/src/TestLuaInterface/TestLuaInterface.csproj
deleted
100644 → 0
View file @
52119866
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion=
"4.0"
>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProductVersion>
9.0.30729
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
<ProjectGuid>
{AEAB974E-4F69-4840-A2C4-7BC55F7C7C3E}
</ProjectGuid>
<OutputType>
Exe
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
LuaInterface.Tests
</RootNamespace>
<AssemblyName>
TestLua
</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>
3.5
</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>
v4.0
</TargetFrameworkVersion>
<PublishUrl>
publish\
</PublishUrl>
<Install>
true
</Install>
<InstallFrom>
Disk
</InstallFrom>
<UpdateEnabled>
false
</UpdateEnabled>
<UpdateMode>
Foreground
</UpdateMode>
<UpdateInterval>
7
</UpdateInterval>
<UpdateIntervalUnits>
Days
</UpdateIntervalUnits>
<UpdatePeriodically>
false
</UpdatePeriodically>
<UpdateRequired>
false
</UpdateRequired>
<MapFileExtensions>
true
</MapFileExtensions>
<ApplicationRevision>
0
</ApplicationRevision>
<ApplicationVersion>
1.0.0.%2a
</ApplicationVersion>
<IsWebBootstrapper>
false
</IsWebBootstrapper>
<UseApplicationTrust>
false
</UseApplicationTrust>
<BootstrapperEnabled>
true
</BootstrapperEnabled>
<TargetFrameworkProfile
/>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\..\..\Built\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
x86
</PlatformTarget>
<CodeAnalysisRuleSet>
AllRules.ruleset
</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<PlatformTarget>
x86
</PlatformTarget>
<CodeAnalysisRuleSet>
AllRules.ruleset
</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"AssemblyInfo.cs"
/>
<Compile
Include=
"Entity.cs"
/>
<Compile
Include=
"TestLua.cs"
/>
<Compile
Include=
"TestLuaInterface.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\LuaInterface\LuaInterface.csproj"
>
<Project>
{F55CABBB-4108-4A39-94E1-581FD46DC021}
</Project>
<Name>
LuaInterface
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"Properties\"
/>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage
Include=
"Microsoft.Net.Client.3.5"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.5 SP1 Client Profile
</ProductName>
<Install>
false
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Net.Framework.3.5.SP1"
>
<Visible>
False
</Visible>
<ProductName>
.NET Framework 3.5 SP1
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
<BootstrapperPackage
Include=
"Microsoft.Windows.Installer.3.1"
>
<Visible>
False
</Visible>
<ProductName>
Windows Installer 3.1
</ProductName>
<Install>
true
</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None
Include=
"app.config"
/>
</ItemGroup>
<ItemGroup>
<Content
Include=
"Readme.txt"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildBinPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
luainterface/tools/NuGet.exe
deleted
100644 → 0
View file @
52119866
File deleted
Prev
1
2
3
Next
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