本文整理汇总了C#中LuaTable.SetNameValue方法的典型用法代码示例。如果您正苦于以下问题:C# LuaTable.SetNameValue方法的具体用法?C# LuaTable.SetNameValue怎么用?C# LuaTable.SetNameValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaTable
的用法示例。
在下文中一共展示了LuaTable.SetNameValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterFunctions
// Registers functions in library
public static void RegisterFunctions(LuaTable module)
{
module.SetNameValue("huge", new LuaNumber(double.MaxValue));
module.SetNameValue("pi", new LuaNumber(Math.PI));
module.SetNameValue("e", new LuaNumber(Math.E));
module.Register("pow", pow);
module.Register("random", random);
module.Register("randomseed", randomseed);
module.Register("sqrt", sqrt);
}
示例2: date
public static LuaValue date(LuaValue[] values)
{
LuaString format = values[0] as LuaString;
if (format != null)
{
if (format.Text == "*t")
{
LuaTable table = new LuaTable();
DateTime now = DateTime.Now;
table.SetNameValue("year", new LuaNumber (now.Year));
table.SetNameValue("month", new LuaNumber (now.Month ));
table.SetNameValue("day", new LuaNumber (now.Day));
table.SetNameValue("hour", new LuaNumber (now.Hour));
table.SetNameValue("min", new LuaNumber (now.Minute));
table.SetNameValue("sec", new LuaNumber (now.Second));
table.SetNameValue("wday", new LuaNumber ((int)now.DayOfWeek));
table.SetNameValue("yday", new LuaNumber (now.DayOfYear));
table.SetNameValue("isdst", LuaBoolean.From(now.IsDaylightSavingTime()));
}
else
{
return new LuaString(DateTime.Now.ToString(format.Text));
}
}
return new LuaString (DateTime.Now.ToString ());//[PixelCrushers].ToShortDateString());
}
示例3: CreateMetaTable
public static LuaTable CreateMetaTable()
{
LuaTable metatable = new LuaTable();
RegisterFunctions(metatable);
metatable.SetNameValue("__index", metatable);
return metatable;
}
示例4: RegisterModule
// Registers library as module in the environment
public static void RegisterModule(LuaTable environment)
{
LuaTable module = new LuaTable();
RegisterFunctions(module);
environment.SetNameValue("string", module);
}
示例5: RegisterFunctions
public static void RegisterFunctions(LuaTable module)
{
module.SetNameValue("huge", new LuaNumber(double.MaxValue));
module.SetNameValue("pi", new LuaNumber(Math.PI));
module.Register("abs", abs);
module.Register("acos", acos);
module.Register("asin", asin);
module.Register("atan", atan);
module.Register("atan2", atan2);
module.Register("ceil", ceil);
module.Register("cos", cos);
module.Register("cosh", cosh);
module.Register("deg", deg);
module.Register("exp", exp);
module.Register("floor", floor);
module.Register("fmod", fmod);
module.Register("log", log);
module.Register("log10", log10);
module.Register("max", max);
module.Register("min", min);
module.Register("modf", modf);
module.Register("pow", pow);
module.Register("rad", rad);
module.Register("random", random);
module.Register("randomseed", randomseed);
module.Register("sin", sin);
module.Register("sinh", sinh);
module.Register("sqrt", sqrt);
module.Register("tan", tan);
module.Register("tanh", tanh);
}