Comments (3)
oh, i know what you mean, in this part, you must put all you code in one folder, then use the compile command, if you use dll reference, somethings will be different, because the code from dll, may be the true C# code, not lua, future may i will support csproj, like #17
but now you must put all code of what you want to convertd in one folder, then try compile...
from csharp.lua.
write
using System;
namespace HelloLua {
public static class Program {
public static void Main() {
A a = new A();
a.SomeProp = 2;
}
}
public sealed class A {
public int SomeProp { get; set; }
}
}
will be
-- Generated by CSharp.lua Compiler 1.1.0
local System = System
local HelloLua
System.usingDeclare(function (global)
HelloLua = global.HelloLua
end)
System.namespace("HelloLua", function (namespace)
namespace.class("Program", function (namespace)
local Main
Main = function ()
local a = HelloLua.A()
a.SomeProp = 2
end
return {
Main = Main
}
end)
namespace.class("A", function (namespace)
return {
SomeProp = 0
}
end)
end)
auto property will be convet to field, i think this is better, it is simple and performance.
from csharp.lua.
Correct and again I'm sorry, the problem only occurs when the code is in a different assembly:
Write in HelloLua.csproj/Program.cs:
namespace HelloLua
{
class Program
{
public static int MyProp { get; set; }
static void Main(string[] args)
{
MyProp = 4321;
TestLibrary.TestClass.SomeProp = 1234;
}
}
}
Write in TestLibrary.csproj:
namespace TestLibrary
{
public static class TestClass
{
public static int SomeProp { get; set; }
}
}
Compiles to:
HelloLua/Program.lua:
-- Generated by CSharp.lua Compiler 1.1.0
local System = System
local HelloLua
System.usingDeclare(function (global)
HelloLua = global.HelloLua
end)
System.namespace("HelloLua", function (namespace)
namespace.class("Program", function (namespace)
local Main, __staticCtor__
__staticCtor__ = function (this)
this.MyProp = 0
end
Main = function (args)
HelloLua.Program.MyProp = 4321
TestLibrary.TestClass.setSomeProp(1234)
end
return {
Main = Main,
__staticCtor__ = __staticCtor__
}
end)
end)
and TestLibrary/TestClass.lua:
-- Generated by CSharp.lua Compiler 1.1.0
local System = System
System.namespace("TestLibrary", function (namespace)
namespace.class("TestClass", function (namespace)
local __staticCtor__
__staticCtor__ = function (this)
this.SomeProp = 0
end
return {
__staticCtor__ = __staticCtor__
}
end)
end)
The line TestLibrary.TestClass.setSomeProp(1234)
wil error because no setSomeProp generated
from csharp.lua.
Related Issues (20)
- Default ValueTuple is not supported
- HasValue on nullable struct produces bad method order HOT 1
- KeyValuePair does not implement GetHashCode (error about "user-defined struct") HOT 1
- GetHashCode does not always return an int
- Default equality comparer in Dictionary is not used
- Switch on value tuple fails to match due to unassigned destructuring HOT 1
- Switch clause with type matching does not work HOT 1
- Clone on 2-dimensional (2D) array returns a single dimensional array
- Copy constructor of HashSet does not copy
- Aggressive inlining in indexer causes compiler null reference exception
- Braceless using makes method return nil
- Order of input files can cause runtime errors
- 调用await 函数问题 HOT 6
- Another repro of #488 (with nested namespace)
- Interface overloads fail to be disambiguated in generated Lua HOT 1
- Support "response files"
- Self-contained distribution of CSharp.lua
- Could you add the classes to handle JSON and XML?
- Properly handle Pinvoke in code
- Lua to C#
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharp.lua.