コード例 #1
0
ファイル: LuaWatch.cs プロジェクト: SuuperW/DeSmuME-Watch
        /// <summary>
        /// A label for displaying values obtained through Lua scripts.
        /// </summary>
        /// <param name="filePath">The path to the Lua script. The script must contain a GetValue() function, which returns the desired text to be displayed.</param>
        /// <param name="lua">Obtained by calling GetLua() on a WatchManager32Bit.</param>
        public LuaWatch(string filePath, Lua.Lua lua)
        {
            NLua.Lua n = new NLua.Lua();
            n.LoadCLRPackage();
            n.DoString("import ('DeSmuME_Watch', 'DeSmuME_Watch.Lua')");

            n.DoFile(filePath);
            luaGetValue = n.GetFunction("GetValue");
            this.lua    = lua;
            n["WATCH"]  = lua;

            if (luaGetValue == null)
            {
                throw new Exception("Lua script could not be loaded. Make sure it contains the function GetValue().");
            }

            this.AutoSize = true;
            this.SetText("?");
        }
コード例 #2
0
 public WatchManager32Bit(IMemoryHacker32Bit memoryHacker)
 {
     memHacker = memoryHacker;
     lua       = new Lua.Lua(this);
 }