public ScriptObject CreateObject(object value) { if (value == null) { return(ScriptNull.Instance); } else if (value is ScriptObject) { return((ScriptObject)value); } else if (value is ScorpioFunction) { return(CreateFunction((ScorpioFunction)value)); } else if (value is ScorpioHandle) { return(CreateFunction((ScorpioHandle)value)); } else if (value is ScorpioMethod) { return(CreateFunction((ScorpioMethod)value)); } else if (Util.IsBoolObject(value)) { return(CreateBool((bool)value)); } else if (Util.IsStringObject(value)) { return(CreateString((string)value)); } else if (Util.IsNumberObject(value)) { return(CreateNumber(value)); } else if (Util.IsEnumObject(value)) { return(CreateEnum(value)); } return(CreateUserdata(value)); }