本文整理匯總了C#中Wren.Core.Objects.Obj.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Obj.ToString方法的具體用法?C# Obj.ToString怎麽用?C# Obj.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wren.Core.Objects.Obj
的用法示例。
在下文中一共展示了Obj.ToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ImportModule
private Obj ImportModule(Obj name)
{
// If the module is already loaded, we don't need to do anything.
if (_modules.Get(name) != Obj.Undefined) return Obj.Null;
// Load the module's source code from the embedder.
string source = LoadModuleFn(name.ToString());
if (source == null)
{
// Couldn't load the module.
return Obj.MakeString(string.Format("Could not find module '{0}'.", name));
}
ObjFiber moduleFiber = LoadModule(name, source);
// Return the fiber that executes the module.
return moduleFiber;
}
示例2: LoadModule
private ObjFiber LoadModule(Obj name, string source)
{
ObjModule module = GetModule(name);
// See if the module has already been loaded.
if (module == null)
{
module = new ObjModule(name as ObjString);
// Store it in the VM's module registry so we don't load the same module
// multiple times.
_modules.Set(name, module);
// Implicitly import the core module.
ObjModule coreModule = GetCoreModule();
foreach (ModuleVariable t in coreModule.Variables)
{
DefineVariable(module, t.Name, t.Container);
}
}
ObjFn fn = Compiler.Compile(this, module, name.ToString(), source, true);
if (fn == null)
{
// TODO: Should we still store the module even if it didn't compile?
return null;
}
ObjFiber moduleFiber = new ObjFiber(fn);
// Return the fiber that executes the module.
return moduleFiber;
}