Commit 8c0092ef authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Moved to KeraLua.

parent 8727f69d
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
<RootNamespace>LuaRunner</RootNamespace> <RootNamespace>LuaRunner</RootNamespace>
<AssemblyName>LuaRunner</AssemblyName> <AssemblyName>LuaRunner</AssemblyName>
<ReleaseVersion>2.x</ReleaseVersion> <ReleaseVersion>2.x</ReleaseVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
...@@ -86,6 +88,9 @@ ...@@ -86,6 +88,9 @@
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A42D438C-34B3-4D3D-8165-8D3779FE16A7}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConsoleTest</RootNamespace>
<AssemblyName>ConsoleTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\LuaInterface\LuaInterface.csproj">
<Project>{f55cabbb-4108-4a39-94e1-581fd46dc021}</Project>
<Name>LuaInterface</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleTest
{
class Program
{
static void Main (string [] args)
{
using (var lua = new LuaInterface.Lua ()) {
lua.RegisterFunction ("p", null, typeof (System.Console).GetMethod ("WriteLine", new Type [] { typeof (String) }));
/// Lua command that works (prints to console)
lua.DoString ("p('Foo')");
/// Yet this works...
lua.DoString ("string.gsub('some string', '(%w+)', function(s) p(s) end)");
/// This fails if you don't fix Lua5.1 lstrlib.c/add_value to treat LUA_TUSERDATA the same as LUA_FUNCTION
lua.DoString ("string.gsub('some string', '(%w+)', p)");
}
}
}
}
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 ("ConsoleTest")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("ConsoleTest")]
[assembly: AssemblyCopyright ("Copyright © 2013")]
[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 ("7c99edf7-f9ea-40fd-9ff9-c463f501e21a")]
// 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 ("1.0.0.0")]
[assembly: AssemblyFileVersion ("1.0.0.0")]
Subproject commit 882a6d9de35ed57d7d6196caf74bd8b61888d0d4 Subproject commit 2eb01c39e6baa79ec8d5fee8ffbe8611e993e4b8
Subproject commit e80399290eaaae17fe02aa711f17f28bf3b13017 Subproject commit f6a5029fb6650fe1cb763de1adf0df2f76a2fab6
...@@ -30,7 +30,7 @@ using LuaInterface.Extensions; ...@@ -30,7 +30,7 @@ using LuaInterface.Extensions;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Type checking and conversion functions. * Type checking and conversion functions.
......
...@@ -26,7 +26,7 @@ using System; ...@@ -26,7 +26,7 @@ using System;
namespace LuaInterface.Event namespace LuaInterface.Event
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/// <summary> /// <summary>
/// Event args for hook callback event /// Event args for hook callback event
......
...@@ -26,7 +26,7 @@ using System; ...@@ -26,7 +26,7 @@ using System;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Class used for generating delegates that get a table from the Lua * Class used for generating delegates that get a table from the Lua
* stack as a an object of a specific type. * stack as a an object of a specific type.
......
...@@ -26,7 +26,7 @@ using System; ...@@ -26,7 +26,7 @@ using System;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Class used for generating delegates that get a function from the Lua * Class used for generating delegates that get a function from the Lua
* stack as a delegate of a specific type. * stack as a delegate of a specific type.
......
...@@ -36,7 +36,7 @@ using LuaInterface.Extensions; ...@@ -36,7 +36,7 @@ using LuaInterface.Extensions;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Main class of LuaInterface * Main class of LuaInterface
...@@ -240,6 +240,10 @@ namespace LuaInterface ...@@ -240,6 +240,10 @@ namespace LuaInterface
//luaState = LuaCore.lua_State.Zero; <- suggested by Christopher Cebulski http://luaforge.net/forum/forum.php?thread_id = 44593&forum_id = 146 //luaState = LuaCore.lua_State.Zero; <- suggested by Christopher Cebulski http://luaforge.net/forum/forum.php?thread_id = 44593&forum_id = 146
} }
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
static int PanicCallback (LuaCore.lua_State luaState) static int PanicCallback (LuaCore.lua_State luaState)
{ {
// string desc = LuaLib.lua_tostring(luaState, 1); // string desc = LuaLib.lua_tostring(luaState, 1);
...@@ -866,6 +870,11 @@ namespace LuaInterface ...@@ -866,6 +870,11 @@ namespace LuaInterface
/// <param name = "luaState">lua state</param> /// <param name = "luaState">lua state</param>
/// <param name = "luaDebug">Pointer to LuaDebug (lua_debug) structure</param> /// <param name = "luaDebug">Pointer to LuaDebug (lua_debug) structure</param>
/// <author>Reinhard Ostermeier</author> /// <author>Reinhard Ostermeier</author>
///
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_Hook))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private void DebugHookCallback (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug) private void DebugHookCallback (LuaCore.lua_State luaState, LuaCore.lua_Debug luaDebug)
{ {
try { try {
......
...@@ -28,7 +28,7 @@ using System.Collections.Generic; ...@@ -28,7 +28,7 @@ using System.Collections.Generic;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
public class LuaFunction : LuaBase public class LuaFunction : LuaBase
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<RootNamespace>LuaInterface</RootNamespace> <RootNamespace>LuaInterface</RootNamespace>
<AssemblyName>LuaInterface</AssemblyName> <AssemblyName>LuaInterface</AssemblyName>
<ReleaseVersion>2.x</ReleaseVersion> <ReleaseVersion>2.x</ReleaseVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
......
...@@ -29,7 +29,7 @@ using LuaInterface.Extensions; ...@@ -29,7 +29,7 @@ using LuaInterface.Extensions;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
public class LuaLib public class LuaLib
{ {
......
...@@ -29,7 +29,7 @@ using System.Collections.Generic; ...@@ -29,7 +29,7 @@ using System.Collections.Generic;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Wrapper class for Lua tables * Wrapper class for Lua tables
......
...@@ -28,7 +28,7 @@ using System.Collections.Generic; ...@@ -28,7 +28,7 @@ using System.Collections.Generic;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
public class LuaUserData : LuaBase public class LuaUserData : LuaBase
{ {
......
...@@ -34,7 +34,7 @@ using LuaInterface.Extensions; ...@@ -34,7 +34,7 @@ using LuaInterface.Extensions;
namespace LuaInterface namespace LuaInterface
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Functions used in the metatables of userdata representing * Functions used in the metatables of userdata representing
...@@ -86,6 +86,10 @@ namespace LuaInterface ...@@ -86,6 +86,10 @@ namespace LuaInterface
/* /*
* __call metafunction of CLR delegates, retrieves and calls the delegate. * __call metafunction of CLR delegates, retrieves and calls the delegate.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int runFunctionDelegate (LuaCore.lua_State luaState) private int runFunctionDelegate (LuaCore.lua_State luaState)
{ {
LuaCore.lua_CFunction func = (LuaCore.lua_CFunction)translator.getRawNetObject (luaState, 1); LuaCore.lua_CFunction func = (LuaCore.lua_CFunction)translator.getRawNetObject (luaState, 1);
...@@ -96,6 +100,10 @@ namespace LuaInterface ...@@ -96,6 +100,10 @@ namespace LuaInterface
/* /*
* __gc metafunction of CLR objects. * __gc metafunction of CLR objects.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int collectObject (LuaCore.lua_State luaState) private int collectObject (LuaCore.lua_State luaState)
{ {
int udata = LuaLib.luanet_rawnetobj (luaState, 1); int udata = LuaLib.luanet_rawnetobj (luaState, 1);
...@@ -112,6 +120,10 @@ namespace LuaInterface ...@@ -112,6 +120,10 @@ namespace LuaInterface
/* /*
* __tostring metafunction of CLR objects. * __tostring metafunction of CLR objects.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int toString (LuaCore.lua_State luaState) private int toString (LuaCore.lua_State luaState)
{ {
object obj = translator.getRawNetObject (luaState, 1); object obj = translator.getRawNetObject (luaState, 1);
...@@ -156,6 +168,10 @@ namespace LuaInterface ...@@ -156,6 +168,10 @@ namespace LuaInterface
* either the value of the member or a delegate to call it. * either the value of the member or a delegate to call it.
* If the member does not exist returns nil. * If the member does not exist returns nil.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getMethod (LuaCore.lua_State luaState) private int getMethod (LuaCore.lua_State luaState)
{ {
object obj = translator.getRawNetObject (luaState, 1); object obj = translator.getRawNetObject (luaState, 1);
...@@ -247,6 +263,10 @@ namespace LuaInterface ...@@ -247,6 +263,10 @@ namespace LuaInterface
* __index metafunction of base classes (the base field of Lua tables). * __index metafunction of base classes (the base field of Lua tables).
* Adds a prefix to the method name to call the base version of the method. * Adds a prefix to the method name to call the base version of the method.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getBaseMethod (LuaCore.lua_State luaState) private int getBaseMethod (LuaCore.lua_State luaState)
{ {
object obj = translator.getRawNetObject (luaState, 1); object obj = translator.getRawNetObject (luaState, 1);
...@@ -444,6 +464,10 @@ namespace LuaInterface ...@@ -444,6 +464,10 @@ namespace LuaInterface
* the member name and the value to be stored as arguments. Throws * the member name and the value to be stored as arguments. Throws
* and error if the assignment is invalid. * and error if the assignment is invalid.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int setFieldOrProperty (LuaCore.lua_State luaState) private int setFieldOrProperty (LuaCore.lua_State luaState)
{ {
object target = translator.getRawNetObject (luaState, 1); object target = translator.getRawNetObject (luaState, 1);
...@@ -607,6 +631,10 @@ namespace LuaInterface ...@@ -607,6 +631,10 @@ namespace LuaInterface
/* /*
* __index metafunction of type references, works on static members. * __index metafunction of type references, works on static members.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int getClassMethod (LuaCore.lua_State luaState) private int getClassMethod (LuaCore.lua_State luaState)
{ {
IReflect klass; IReflect klass;
...@@ -638,6 +666,10 @@ namespace LuaInterface ...@@ -638,6 +666,10 @@ namespace LuaInterface
/* /*
* __newindex function of type references, works on static members. * __newindex function of type references, works on static members.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int setClassFieldOrProperty (LuaCore.lua_State luaState) private int setClassFieldOrProperty (LuaCore.lua_State luaState)
{ {
IReflect target; IReflect target;
...@@ -658,6 +690,10 @@ namespace LuaInterface ...@@ -658,6 +690,10 @@ namespace LuaInterface
* found or if the arguments are invalid. Throws an error if the constructor * found or if the arguments are invalid. Throws an error if the constructor
* generates an exception. * generates an exception.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
private int callConstructor (LuaCore.lua_State luaState) private int callConstructor (LuaCore.lua_State luaState)
{ {
var validConstructor = new MethodCache (); var validConstructor = new MethodCache ();
......
...@@ -30,7 +30,7 @@ using LuaInterface.Extensions; ...@@ -30,7 +30,7 @@ using LuaInterface.Extensions;
namespace LuaInterface.Method namespace LuaInterface.Method
{ {
using LuaCore = KopiLua.Lua; using LuaCore = KeraLua.Lua;
/* /*
* Argument extraction with type-conversion function * Argument extraction with type-conversion function
...@@ -104,6 +104,10 @@ namespace LuaInterface.Method ...@@ -104,6 +104,10 @@ namespace LuaInterface.Method
* Calls the method. Receives the arguments from the Lua stack * Calls the method. Receives the arguments from the Lua stack
* and returns values in it. * and returns values in it.
*/ */
#if MONOTOUCH
[MonoTouch.MonoPInvokeCallback (typeof (Lua.lua_CFunction))]
#endif
[System.Runtime.InteropServices.AllowReversePInvokeCalls]
public int call (LuaCore.lua_State luaState) public int call (LuaCore.lua_State luaState)
{ {
var methodToCall = _Method; var methodToCall = _Method;
......
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