コード例 #1
0
 public void SetVar(string key, DynValue value)
 {
     if (key == null)
     {
         throw new CYFException("script.SetVar: The first argument (key) is null.\n\nSee the documentation for proper usage.");
     }
     script.Globals.Set(key, MoonSharpUtil.CloneIfRequired(script, value));
 }
コード例 #2
0
    public DynValue GetVar(Script caller, string key)
    {
        DynValue value = script.Globals.Get(key);

        if (value == null || value.IsNil())
        {
            return(DynValue.NewNil());
        }
        if (caller == null)
        {
            return(value);
        }
        if (script.Globals[key] != null)
        {
            return(MoonSharpUtil.CloneIfRequired(caller, value));
        }
        return(null);
    }
コード例 #3
0
    public DynValue GetVar(Script caller, string key)
    {
        if (key == null)
        {
            throw new CYFException("script.GetVar: The first argument (key) is nil.\n\nSee the documentation for proper usage.");
        }
        DynValue value = script.Globals.Get(key);

        if (value == null || value.IsNil())
        {
            return(DynValue.NewNil());
        }
        if (caller == null)
        {
            return(value);
        }
        return(script.Globals[key] != null?MoonSharpUtil.CloneIfRequired(caller, value) : null);
    }
コード例 #4
0
 public void SetVar(string key, DynValue value)
 {
     script.Globals.Set(key, MoonSharpUtil.CloneIfRequired(script, value));
 }