Commit 8727f69d authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Fixed NLua to work with KeraLua

parent 7590605a
[submodule "Core/KopiLua"]
path = Core/KopiLua
url = git://github.com/codefoco/KopiLua.git
[submodule "Core/KeraLua"]
path = Core/KeraLua
url = git://github.com/codefoco/KeraLua.git
Subproject commit 882a6d9de35ed57d7d6196caf74bd8b61888d0d4
Subproject commit 9597053ea56012f5a182a93e68b7d708bb930b89
Subproject commit e80399290eaaae17fe02aa711f17f28bf3b13017
......@@ -41,5 +41,10 @@ namespace LuaInterface.Extensions
{
return (obj == null);
}
public static bool IsNull (this IntPtr ptr)
{
return (ptr == null || ptr.Equals (IntPtr.Zero));
}
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ using System;
namespace LuaInterface
{
using LuaCore = KopiLua.Lua;
/*
* Class used for generating delegates that get a table from the Lua
* stack as a an object of a specific type.
......@@ -44,7 +45,7 @@ namespace LuaInterface
this.klass = klass;
}
public object extractGenerated (KopiLua.Lua.lua_State luaState, int stackPos)
public object extractGenerated (LuaCore.lua_State luaState, int stackPos)
{
return CodeGeneration.Instance.GetClassInstance (klass, translator.getTable (luaState, stackPos));
}
......
......@@ -26,6 +26,7 @@ using System;
namespace LuaInterface
{
using LuaCore = KopiLua.Lua;
/*
* Class used for generating delegates that get a function from the Lua
* stack as a delegate of a specific type.
......@@ -37,6 +38,7 @@ namespace LuaInterface
{
private ObjectTranslator translator;
private Type delegateType;
public DelegateGenerator (ObjectTranslator translator, Type delegateType)
{
......@@ -44,7 +46,7 @@ namespace LuaInterface
this.delegateType = delegateType;
}
public object extractGenerated (KopiLua.Lua.lua_State luaState, int stackPos)
public object extractGenerated (LuaCore.lua_State luaState, int stackPos)
{
return CodeGeneration.Instance.GetDelegate (delegateType, translator.getFunction (luaState, stackPos));
}
......
<?xml version="1.0" encoding="utf-8"?>
<?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>
......@@ -11,7 +11,8 @@
<RootNamespace>LuaInterface</RootNamespace>
<AssemblyName>LuaInterface</AssemblyName>
<ReleaseVersion>2.x</ReleaseVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
......@@ -88,17 +89,14 @@
</Target>
-->
<ItemGroup>
<ProjectReference Include="..\KeraLua\KeraLua.csproj">
<Project>{47153754-10f5-44d8-b578-f5a32b69061a}</Project>
<Name>KeraLua</Name>
</ProjectReference>
<ProjectReference Include="..\KopiLua\KopiLua.csproj">
<Project>{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}</Project>
<Name>KopiLua</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Extensions\" />
<Folder Include="GenerateEventAssembly\" />
<Folder Include="Event\" />
<Folder Include="Exceptions\" />
<Folder Include="Method\" />
<Folder Include="Config\" />
</ItemGroup>
</Project>
<ItemGroup />
</Project>
\ No newline at end of file
......@@ -282,7 +282,7 @@ namespace LuaInterface
public static void lua_pushstdcallcfunction (LuaCore.lua_State luaState, LuaCore.lua_CFunction function)
{
LuaCore.lua_pushstdcallcfunction (luaState, function);
LuaCore.lua_pushcfunction (luaState, function);
}
public static int lua_pcall (LuaCore.lua_State luaState, int nArgs, int nResults, int errfunc)
......@@ -432,7 +432,7 @@ namespace LuaInterface
public static void lua_pushlightuserdata (LuaCore.lua_State luaState, LuaCore.LuaTag udata)
{
LuaCore.lua_pushlightuserdata (luaState, udata);
LuaCore.lua_pushlightuserdata (luaState, udata.Tag);
}
public static LuaCore.LuaTag luanet_gettag ()
......
......@@ -445,7 +445,7 @@ namespace LuaInterface
* and error if the assignment is invalid.
*/
private int setFieldOrProperty (LuaCore.lua_State luaState)
{
{
object target = translator.getRawNetObject (luaState, 1);
if (target.IsNull ()) {
......
......@@ -28,8 +28,6 @@ using System.Reflection;
namespace LuaInterface
{
using LuaCore = KopiLua.Lua;
/// <summary>
/// Summary description for ProxyType.
/// </summary>
......

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{0E28CF40-4DFA-46FE-95BB-E90648DFE6F5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Applications", "Applications", "{B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}"
......@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface", "Core\LuaInt
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterfaceTest", "LuaInterfaceTest\LuaInterfaceTest.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeraLua", "Core\KeraLua\KeraLua.csproj", "{47153754-10F5-44D8-B578-F5A32B69061A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -25,10 +27,6 @@ Global
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5}.Release|Any CPU.Build.0 = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.Build.0 = Release|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
......@@ -37,16 +35,28 @@ Global
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F55CABBB-4108-4A39-94E1-581FD46DC021}.Release|Any CPU.Build.0 = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5FCADFA-5047-40C2-B392-256875862920}.Release|Any CPU.Build.0 = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47153754-10F5-44D8-B578-F5A32B69061A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3CE4CCB6-3465-43E3-B5ED-5FB9B70D20E5} = {B13128D8-A4F3-4C53-A4C6-F2EA34F527BD}
{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
{F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
{47153754-10F5-44D8-B578-F5A32B69061A} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = LuaInterfaceTest\LuaInterfaceTest.csproj
Policies = $0
$0.TextStylePolicy = $1
$0.TextStylePolicy = $3
$1.inheritsSet = null
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
......@@ -54,7 +64,6 @@ Global
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$0.TextStylePolicy = $3
$3.inheritsSet = Mono
$3.inheritsScope = text/plain
$3.scope = text/plain
......@@ -63,21 +72,19 @@ Global
$4.IncludeInNewFiles = True
$0.NameConventionPolicy = $5
$5.Rules = $6
$6.NamingRule = $7
$6.NamingRule = $26
$7.Name = Namespaces
$7.AffectedEntity = Namespace
$7.VisibilityMask = VisibilityMask
$7.NamingStyle = PascalCase
$7.IncludeInstanceMembers = True
$7.IncludeStaticEntities = True
$6.NamingRule = $8
$8.Name = Types
$8.AffectedEntity = Class, Struct, Enum, Delegate
$8.VisibilityMask = Public
$8.NamingStyle = PascalCase
$8.IncludeInstanceMembers = True
$8.IncludeStaticEntities = True
$6.NamingRule = $9
$9.Name = Interfaces
$9.RequiredPrefixes = $10
$10.String = I
......@@ -86,7 +93,6 @@ Global
$9.NamingStyle = PascalCase
$9.IncludeInstanceMembers = True
$9.IncludeStaticEntities = True
$6.NamingRule = $11
$11.Name = Attributes
$11.RequiredSuffixes = $12
$12.String = Attribute
......@@ -95,7 +101,6 @@ Global
$11.NamingStyle = PascalCase
$11.IncludeInstanceMembers = True
$11.IncludeStaticEntities = True
$6.NamingRule = $13
$13.Name = Event Arguments
$13.RequiredSuffixes = $14
$14.String = EventArgs
......@@ -104,7 +109,6 @@ Global
$13.NamingStyle = PascalCase
$13.IncludeInstanceMembers = True
$13.IncludeStaticEntities = True
$6.NamingRule = $15
$15.Name = Exceptions
$15.RequiredSuffixes = $16
$16.String = Exception
......@@ -113,70 +117,60 @@ Global
$15.NamingStyle = PascalCase
$15.IncludeInstanceMembers = True
$15.IncludeStaticEntities = True
$6.NamingRule = $17
$17.Name = Methods
$17.AffectedEntity = Methods
$17.VisibilityMask = Protected, Public
$17.NamingStyle = PascalCase
$17.IncludeInstanceMembers = True
$17.IncludeStaticEntities = True
$6.NamingRule = $18
$18.Name = Static Readonly Fields
$18.AffectedEntity = ReadonlyField
$18.VisibilityMask = Protected, Public
$18.NamingStyle = PascalCase
$18.IncludeInstanceMembers = False
$18.IncludeStaticEntities = True
$6.NamingRule = $19
$19.Name = Fields
$19.AffectedEntity = Field
$19.VisibilityMask = Protected, Public
$19.NamingStyle = PascalCase
$19.IncludeInstanceMembers = True
$19.IncludeStaticEntities = True
$6.NamingRule = $20
$20.Name = ReadOnly Fields
$20.AffectedEntity = ReadonlyField
$20.VisibilityMask = Protected, Public
$20.NamingStyle = PascalCase
$20.IncludeInstanceMembers = True
$20.IncludeStaticEntities = False
$6.NamingRule = $21
$21.Name = Constant Fields
$21.AffectedEntity = ConstantField
$21.VisibilityMask = Protected, Public
$21.NamingStyle = PascalCase
$21.IncludeInstanceMembers = True
$21.IncludeStaticEntities = True
$6.NamingRule = $22
$22.Name = Properties
$22.AffectedEntity = Property
$22.VisibilityMask = Protected, Public
$22.NamingStyle = PascalCase
$22.IncludeInstanceMembers = True
$22.IncludeStaticEntities = True
$6.NamingRule = $23
$23.Name = Events
$23.AffectedEntity = Event
$23.VisibilityMask = Protected, Public
$23.NamingStyle = PascalCase
$23.IncludeInstanceMembers = True
$23.IncludeStaticEntities = True
$6.NamingRule = $24
$24.Name = Enum Members
$24.AffectedEntity = EnumMember
$24.VisibilityMask = VisibilityMask
$24.NamingStyle = PascalCase
$24.IncludeInstanceMembers = True
$24.IncludeStaticEntities = True
$6.NamingRule = $25
$25.Name = Parameters
$25.AffectedEntity = Parameter
$25.VisibilityMask = VisibilityMask
$25.NamingStyle = CamelCase
$25.IncludeInstanceMembers = True
$25.IncludeStaticEntities = True
$6.NamingRule = $26
$26.Name = Type Parameters
$26.RequiredPrefixes = $27
$27.String = T
......@@ -191,7 +185,4 @@ Global
description = LuaInterface
version = 2.x
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
......@@ -51,6 +51,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\KeraLua\KeraLua.csproj">
<Project>{47153754-10f5-44d8-b578-f5a32b69061a}</Project>
<Name>KeraLua</Name>
</ProjectReference>
<ProjectReference Include="..\Core\KopiLua\KopiLua.csproj">
<Project>{E8DDBC21-EF74-4ABA-9C49-BFC702BE25D8}</Project>
<Name>KopiLua</Name>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment