1408 lines
53 KiB
C#
1408 lines
53 KiB
C#
#if USE_UNI_LUA
|
|
using LuaAPI = UniLua.Lua;
|
|
using RealStatePtr = UniLua.ILuaState;
|
|
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
|
|
#else
|
|
using LuaAPI = XLua.LuaDLL.Lua;
|
|
using RealStatePtr = System.IntPtr;
|
|
using LuaCSFunction = XLuaBase.lua_CSFunction;
|
|
#endif
|
|
|
|
using XLua;
|
|
using System.Collections.Generic;
|
|
|
|
|
|
namespace XLua.CSObjectWrap
|
|
{
|
|
using Utils = XLua.Utils;
|
|
public class SystemTimeSpanWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(System.TimeSpan);
|
|
Utils.BeginObjectRegister(type, L, translator, 8, 10, 11, 0);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__unm", __UnmMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__sub", __SubMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__add", __AddMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__mul", __MulMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__div", __DivMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__eq", __EqMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__lt", __LTMeta);
|
|
Utils.RegisterFunc(L, Utils.OBJ_META_IDX, "__le", __LEMeta);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Add", _m_Add);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CompareTo", _m_CompareTo);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Duration", _m_Duration);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Negate", _m_Negate);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Subtract", _m_Subtract);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Multiply", _m_Multiply);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Divide", _m_Divide);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToString", _m_ToString);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Ticks", _g_get_Ticks);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Days", _g_get_Days);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Hours", _g_get_Hours);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Milliseconds", _g_get_Milliseconds);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Minutes", _g_get_Minutes);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Seconds", _g_get_Seconds);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TotalDays", _g_get_TotalDays);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TotalHours", _g_get_TotalHours);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TotalMilliseconds", _g_get_TotalMilliseconds);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TotalMinutes", _g_get_TotalMinutes);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "TotalSeconds", _g_get_TotalSeconds);
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 21, 0, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Compare", _m_Compare_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromDays", _m_FromDays_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Equals", _m_Equals_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromHours", _m_FromHours_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromMilliseconds", _m_FromMilliseconds_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromMinutes", _m_FromMinutes_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromSeconds", _m_FromSeconds_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FromTicks", _m_FromTicks_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Parse", _m_Parse_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "ParseExact", _m_ParseExact_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "TryParse", _m_TryParse_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "TryParseExact", _m_TryParseExact_xlua_st_);
|
|
|
|
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "TicksPerMillisecond", System.TimeSpan.TicksPerMillisecond);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "TicksPerSecond", System.TimeSpan.TicksPerSecond);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "TicksPerMinute", System.TimeSpan.TicksPerMinute);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "TicksPerHour", System.TimeSpan.TicksPerHour);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "TicksPerDay", System.TimeSpan.TicksPerDay);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "Zero", System.TimeSpan.Zero);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "MaxValue", System.TimeSpan.MaxValue);
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "MinValue", System.TimeSpan.MinValue);
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
if(LuaAPI.lua_gettop(L) == 2 && (LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) || LuaAPI.lua_isint64(L, 2)))
|
|
{
|
|
long _ticks = LuaAPI.lua_toint64(L, 2);
|
|
|
|
var gen_ret = new System.TimeSpan(_ticks);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
|
|
{
|
|
int _hours = LuaAPI.xlua_tointeger(L, 2);
|
|
int _minutes = LuaAPI.xlua_tointeger(L, 3);
|
|
int _seconds = LuaAPI.xlua_tointeger(L, 4);
|
|
|
|
var gen_ret = new System.TimeSpan(_hours, _minutes, _seconds);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
|
|
{
|
|
int _days = LuaAPI.xlua_tointeger(L, 2);
|
|
int _hours = LuaAPI.xlua_tointeger(L, 3);
|
|
int _minutes = LuaAPI.xlua_tointeger(L, 4);
|
|
int _seconds = LuaAPI.xlua_tointeger(L, 5);
|
|
|
|
var gen_ret = new System.TimeSpan(_days, _hours, _minutes, _seconds);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 6 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6))
|
|
{
|
|
int _days = LuaAPI.xlua_tointeger(L, 2);
|
|
int _hours = LuaAPI.xlua_tointeger(L, 3);
|
|
int _minutes = LuaAPI.xlua_tointeger(L, 4);
|
|
int _seconds = LuaAPI.xlua_tointeger(L, 5);
|
|
int _milliseconds = LuaAPI.xlua_tointeger(L, 6);
|
|
|
|
var gen_ret = new System.TimeSpan(_days, _hours, _minutes, _seconds, _milliseconds);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
|
|
if (LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
translator.Push(L, default(System.TimeSpan));
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __UnmMeta(RealStatePtr L)
|
|
{
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
try {
|
|
System.TimeSpan rightside;translator.Get(L, 1, out rightside);
|
|
translator.Push(L, - rightside);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __SubMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside - rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of - operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __AddMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside + rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of + operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __MulMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
double rightside = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
translator.Push(L, leftside * rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
if (LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
double leftside = LuaAPI.lua_tonumber(L, 1);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
translator.Push(L, leftside * rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of * operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __DivMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
double rightside = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
translator.Push(L, leftside / rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushnumber(L, leftside / rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of / operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __EqMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside == rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of == operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __LTMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside < rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of < operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __LEMeta(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
if (translator.Assignable<System.TimeSpan>(L, 1) && translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan leftside;translator.Get(L, 1, out leftside);
|
|
System.TimeSpan rightside;translator.Get(L, 2, out rightside);
|
|
|
|
LuaAPI.lua_pushboolean(L, leftside <= rightside);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to right hand of <= operator, need System.TimeSpan!");
|
|
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Add(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
System.TimeSpan _ts;translator.Get(L, 2, out _ts);
|
|
|
|
var gen_ret = gen_to_be_invoked.Add( _ts );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Compare_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.TimeSpan _t1;translator.Get(L, 1, out _t1);
|
|
System.TimeSpan _t2;translator.Get(L, 2, out _t2);
|
|
|
|
var gen_ret = System.TimeSpan.Compare( _t1, _t2 );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_CompareTo(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<object>(L, 2))
|
|
{
|
|
object _value = translator.GetObject(L, 2, typeof(object));
|
|
|
|
var gen_ret = gen_to_be_invoked.CompareTo( _value );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan _value;translator.Get(L, 2, out _value);
|
|
|
|
var gen_ret = gen_to_be_invoked.CompareTo( _value );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.CompareTo!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromDays_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromDays( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Duration(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.Duration( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Equals(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<object>(L, 2))
|
|
{
|
|
object _value = translator.GetObject(L, 2, typeof(object));
|
|
|
|
var gen_ret = gen_to_be_invoked.Equals( _value );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan _obj;translator.Get(L, 2, out _obj);
|
|
|
|
var gen_ret = gen_to_be_invoked.Equals( _obj );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.Equals!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Equals_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
System.TimeSpan _t1;translator.Get(L, 1, out _t1);
|
|
System.TimeSpan _t2;translator.Get(L, 2, out _t2);
|
|
|
|
var gen_ret = System.TimeSpan.Equals( _t1, _t2 );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetHashCode(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.GetHashCode( );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromHours_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromHours( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromMilliseconds_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromMilliseconds( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromMinutes_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromMinutes( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Negate(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.Negate( );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromSeconds_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
double _value = LuaAPI.lua_tonumber(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromSeconds( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Subtract(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
System.TimeSpan _ts;translator.Get(L, 2, out _ts);
|
|
|
|
var gen_ret = gen_to_be_invoked.Subtract( _ts );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Multiply(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
|
|
{
|
|
double _factor = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.Multiply( _factor );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Divide(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
|
|
{
|
|
double _divisor = LuaAPI.lua_tonumber(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.Divide( _divisor );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.TimeSpan>(L, 2))
|
|
{
|
|
System.TimeSpan _ts;translator.Get(L, 2, out _ts);
|
|
|
|
var gen_ret = gen_to_be_invoked.Divide( _ts );
|
|
LuaAPI.lua_pushnumber(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.Divide!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_FromTicks_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
long _value = LuaAPI.lua_toint64(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.FromTicks( _value );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Parse_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
|
|
var gen_ret = System.TimeSpan.Parse( _s );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 2))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = System.TimeSpan.Parse( _input, _formatProvider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.Parse!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ParseExact_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = System.TimeSpan.ParseExact( _input, _format, _formatProvider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = System.TimeSpan.ParseExact( _input, _formats, _formatProvider );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.TimeSpanStyles>(L, 4))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.TimeSpanStyles _styles;translator.Get(L, 4, out _styles);
|
|
|
|
var gen_ret = System.TimeSpan.ParseExact( _input, _format, _formatProvider, _styles );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.TimeSpanStyles>(L, 4))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.TimeSpanStyles _styles;translator.Get(L, 4, out _styles);
|
|
|
|
var gen_ret = System.TimeSpan.ParseExact( _input, _formats, _formatProvider, _styles );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.ParseExact!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_TryParse_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _s = LuaAPI.lua_tostring(L, 1);
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParse( _s, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 2))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 2, typeof(System.IFormatProvider));
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParse( _input, _formatProvider, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.TryParse!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_TryParseExact_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParseExact( _input, _format, _formatProvider, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParseExact( _input, _formats, _formatProvider, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.TimeSpanStyles>(L, 4))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.TimeSpanStyles _styles;translator.Get(L, 4, out _styles);
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParseExact( _input, _format, _formatProvider, _styles, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<string[]>(L, 2)&& translator.Assignable<System.IFormatProvider>(L, 3)&& translator.Assignable<System.Globalization.TimeSpanStyles>(L, 4))
|
|
{
|
|
string _input = LuaAPI.lua_tostring(L, 1);
|
|
string[] _formats = (string[])translator.GetObject(L, 2, typeof(string[]));
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
System.Globalization.TimeSpanStyles _styles;translator.Get(L, 4, out _styles);
|
|
System.TimeSpan _result;
|
|
|
|
var gen_ret = System.TimeSpan.TryParseExact( _input, _formats, _formatProvider, _styles, out _result );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
translator.Push(L, _result);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.TryParseExact!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ToString(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 1)
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _format );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.IFormatProvider>(L, 3))
|
|
{
|
|
string _format = LuaAPI.lua_tostring(L, 2);
|
|
System.IFormatProvider _formatProvider = (System.IFormatProvider)translator.GetObject(L, 3, typeof(System.IFormatProvider));
|
|
|
|
var gen_ret = gen_to_be_invoked.ToString( _format, _formatProvider );
|
|
LuaAPI.lua_pushstring(L, gen_ret);
|
|
|
|
|
|
translator.Update(L, 1, gen_to_be_invoked);
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to System.TimeSpan.ToString!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Ticks(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushint64(L, gen_to_be_invoked.Ticks);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Days(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Days);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Hours(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Hours);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Milliseconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Milliseconds);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Minutes(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Minutes);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Seconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Seconds);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TotalDays(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.TotalDays);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TotalHours(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.TotalHours);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TotalMilliseconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.TotalMilliseconds);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TotalMinutes(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.TotalMinutes);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_TotalSeconds(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
System.TimeSpan gen_to_be_invoked;translator.Get(L, 1, out gen_to_be_invoked);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.TotalSeconds);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|