コード例 #1
0
ファイル: CoreFunctions.cs プロジェクト: stroan/Lamn
        private static Table GetStringTable()
        {
            Table stringTable = new Table();
            stringTable.RawPut("len", new State.NativeFuncDelegate(StrLen));
            stringTable.RawPut("gsub", new State.NativeFuncDelegate(StrGSub));
            stringTable.RawPut("format", new State.NativeFuncDelegate(StrFmt));

            return stringTable;
        }
コード例 #2
0
ファイル: CoreFunctions.cs プロジェクト: stroan/Lamn
        private static Table GetMathTable()
        {
            Table mathTable = new Table();
            mathTable.RawPut("sin", new State.NativeFuncDelegate(Sin));
            mathTable.RawPut("fmod", new State.NativeFuncDelegate(FMod));
            mathTable.RawPut("floor", new State.NativeFuncDelegate(Floor));

            return mathTable;
        }
コード例 #3
0
ファイル: CoreFunctions.cs プロジェクト: stroan/Lamn
        private static Table GetCoroutineTable()
        {
            Table coroutineTable = new Table();
            coroutineTable.RawPut("create", new State.NativeFuncDelegate(CoroutineCreate));
            coroutineTable.RawPut("resume", new State.NativeCoreFuncDelegate(CoroutineResume));
            coroutineTable.RawPut("yield", new State.NativeCoreFuncDelegate(CoroutineYield));

            return coroutineTable;
        }
コード例 #4
0
ファイル: CoreFunctions.cs プロジェクト: stroan/Lamn
 private static Table GetDebugTable()
 {
     Table debugTable = new Table();
     debugTable.RawPut ("getinfo", new State.NativeFuncDelegate(DebugGetInfo));
     return debugTable;
 }
コード例 #5
0
ファイル: CoreFunctions.cs プロジェクト: stroan/Lamn
 private static VarArgs DebugGetInfo(VarArgs args, LamnEngine s)
 {
     VarArgs retArgs = new VarArgs();
     List<ReturnPoint> stack = s.LamnState.GetStackTrace();
     int func = (int)((double)args.PopArg() - 1);
     String spec = (String)args.PopArg();
     if (spec.Equals("n") && func < stack.Count) {
         Table t = new Table();
         ReturnPoint retPoint = stack[func];
         t.RawPut("name", retPoint.instructionPointer.CurrentFunction.Name);
         retArgs.PushArg(t);
     }
     return retArgs;
 }