Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: add a possibility to include lua snippets #21

Closed
AqlaSolutions opened this issue Jul 26, 2017 · 1 comment
Closed

Request: add a possibility to include lua snippets #21

AqlaSolutions opened this issue Jul 26, 2017 · 1 comment

Comments

@AqlaSolutions
Copy link

AqlaSolutions commented Jul 26, 2017

Like

// normal code
#if lua
       --load() and other lua stuff
#endif
// C# again

or better a syntax that can return a value

@yanghuan
Copy link
Owner

yanghuan commented Jun 7, 2018

support insert lua code when compile

using System;
namespace Test {
  public class Program {
    public static void Main(string[] args) {
#if __CSharpLua__
      /*
      [[
      local i = "hello, word"
      print(i)
      ]]*/  
#else
      Console.WriteLine("hello, word");
#endif

      //insert lua code
      /*
      [[
      print('insert lua code')
      ]] 
      */
    }
  }
}

output

-- Generated by CSharp.lua Compiler 1.1.0
local System = System
System.namespace("Test", function (namespace) 
  namespace.class("Program", function (namespace) 
    local Main
    Main = function (args) 
      local i = "hello, word"
      print(i)




      --insert lua code
      print('insert lua code')
    end
    return {
      Main = Main
    }
  end)
end)

1084314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants