30 lines
707 B
C#
30 lines
707 B
C#
|
using System;
|
||
|
using Upsilon.BaseTypes.Number;
|
||
|
|
||
|
namespace Upsilon.BaseTypes
|
||
|
{
|
||
|
public static class TypeConversion
|
||
|
{
|
||
|
public static LuaType ToLuaType(this object o)
|
||
|
{
|
||
|
switch (o)
|
||
|
{
|
||
|
case bool b:
|
||
|
return new LuaBoolean(b);
|
||
|
case int i:
|
||
|
return new NumberLong(i);
|
||
|
case long i:
|
||
|
return new NumberLong(i);
|
||
|
case float f:
|
||
|
return new NumberDouble(f);
|
||
|
case double f:
|
||
|
return new NumberDouble(f);
|
||
|
|
||
|
|
||
|
default:
|
||
|
throw new Exception();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|