Ejemplo n.º 1
0
        private static int os_rename(lua_State L)
        {
            CharPtr fromname = luaL_checkstring(L, 1);
            CharPtr toname   = luaL_checkstring(L, 2);
            int     result;

            try
            {
#if !NETFX_CORE
                File.Move(fromname.ToString(), toname.ToString());
#endif
                result = 0;
            }
            catch
            {
                result = 1;           // todo: this should be a proper error code
            }
            return(os_pushresult(L, result, fromname));
        }
Ejemplo n.º 2
0
        private static int os_execute(lua_State L)
        {
#if XBOX
            luaL_error(L, "os_execute not supported on XBox360");
#elif WINDOWS_PHONE
            luaL_error(L, "os_execute not supported on Windows Phone");
#elif NETFX_CORE
            luaL_error(L, "os_execute not supported on Windows Runtime");
#else
            CharPtr strCmdLine = "/C regenresx " + luaL_optstring(L, 1, null);
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.EnableRaisingEvents = false;
            proc.StartInfo.FileName  = "CMD.exe";
            proc.StartInfo.Arguments = strCmdLine.ToString();
            proc.Start();
            proc.WaitForExit();
            lua_pushinteger(L, proc.ExitCode);
#endif
            return(1);
        }
Ejemplo n.º 3
0
 public override string ToString()
 {
     return(str.ToString());
 }                                                            // for debugging
Ejemplo n.º 4
0
        //typedef struct Object *lua_Object;

        public static void lua_register(CharPtr n, lua_CFunction f)
        {
            lua_pushcfunction(f, n.ToString()); lua_storeglobal(n);
        }
Ejemplo n.º 5
0
        public static string SetLocal(ScriptState luaState, LuaDebug ar, int n)
        {
            CharPtr local = ScriptApi.SetLocal(luaState, ar, n);

            return(local.ToString());
        }
Ejemplo n.º 6
0
        public static string ToString(ScriptState luaState, int index)
        {
            CharPtr ptrString = ScriptApi.ToString(luaState, ConvertParmenterIndex(index));

            return(ptrString.ToString());
        }