本文整理汇总了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;
}