| 15 | namespace Tutorial |
| 16 | { |
| 17 | public class CSCallLua : MonoBehaviour |
| 18 | { |
| 19 | LuaEnv luaenv = null; |
| 20 | string script = @" |
| 21 | a = 1 |
| 22 | b = 'hello world' |
| 23 | c = true |
| 24 | |
| 25 | d = { |
| 26 | f1 = 12, f2 = 34, |
| 27 | 1, 2, 3, |
| 28 | add = function(self, a, b) |
| 29 | print('d.add called') |
| 30 | return a + b |
| 31 | end |
| 32 | } |
| 33 | |
| 34 | function e() |
| 35 | print('i am e') |
| 36 | end |
| 37 | |
| 38 | function f(a, b) |
| 39 | print('a', a, 'b', b) |
| 40 | return 1, {f1 = 1024} |
| 41 | end |
| 42 | |
| 43 | function ret_e() |
| 44 | print('ret_e called') |
| 45 | return e |
| 46 | end |
| 47 | "; |
| 48 | |
| 49 | public class DClass |
| 50 | { |
| 51 | public int f1; |
| 52 | public int f2; |
| 53 | } |
| 54 | |
| 55 | [CSharpCallLua] |
| 56 | public interface ItfD |
| 57 | { |
| 58 | int f1 { get; set; } |
| 59 | int f2 { get; set; } |
| 60 | int add(int a, int b); |
| 61 | } |
| 62 | |
| 63 | [CSharpCallLua] |
| 64 | public delegate int FDelegate(int a, string b, out DClass c); |
| 65 | |
| 66 | [CSharpCallLua] |
| 67 | public delegate Action GetE(); |
| 68 | |
| 69 | // Use this for initialization |
| 70 | void Start() |
| 71 | { |
| 72 | luaenv = new LuaEnv(); |
| 73 | luaenv.DoString(script); |
| 74 |
nothing calls this directly
no outgoing calls
no test coverage detected