LuaUInt64Wrap.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //this source code was auto-generated by tolua#, do not modify it
  2. using System;
  3. using LuaInterface;
  4. public class LuaUInt64Wrap
  5. {
  6. public static void Register(LuaState L)
  7. {
  8. L.BeginClass(typeof(LuaUInt64), typeof(System.Object), "LuaUInt64");
  9. L.RegFunction("Make", Make);
  10. L.RegFunction("FromString", FromString);
  11. L.RegFunction("And", And);
  12. L.RegFunction("Or", Or);
  13. L.RegFunction("Xor", Xor);
  14. L.RegFunction("FromDouble", FromDouble);
  15. L.RegFunction("ToDouble", ToDouble);
  16. L.RegFunction("ToString", ToString);
  17. L.RegFunction("UInt64ToBytes", UInt64ToBytes);
  18. L.RegFunction("BytesToUInt64", BytesToUInt64);
  19. L.RegFunction("New", _CreateLuaUInt64);
  20. L.RegFunction("__tostring", ToLua.op_ToString);
  21. L.EndClass();
  22. }
  23. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  24. static int _CreateLuaUInt64(IntPtr L)
  25. {
  26. try
  27. {
  28. int count = LuaDLL.lua_gettop(L);
  29. if (count == 0)
  30. {
  31. LuaUInt64 obj = new LuaUInt64();
  32. ToLua.PushObject(L, obj);
  33. return 1;
  34. }
  35. else
  36. {
  37. return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaUInt64.New");
  38. }
  39. }
  40. catch (Exception e)
  41. {
  42. return LuaDLL.toluaL_exception(L, e);
  43. }
  44. }
  45. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  46. static int Make(IntPtr L)
  47. {
  48. try
  49. {
  50. ToLua.CheckArgsCount(L, 2);
  51. uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 1);
  52. uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 2);
  53. byte[] o = LuaUInt64.Make(arg0, arg1);
  54. ToLua.Push(L, o);
  55. return 1;
  56. }
  57. catch (Exception e)
  58. {
  59. return LuaDLL.toluaL_exception(L, e);
  60. }
  61. }
  62. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  63. static int FromString(IntPtr L)
  64. {
  65. try
  66. {
  67. ToLua.CheckArgsCount(L, 1);
  68. string arg0 = ToLua.CheckString(L, 1);
  69. byte[] o = LuaUInt64.FromString(arg0);
  70. ToLua.Push(L, o);
  71. return 1;
  72. }
  73. catch (Exception e)
  74. {
  75. return LuaDLL.toluaL_exception(L, e);
  76. }
  77. }
  78. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  79. static int And(IntPtr L)
  80. {
  81. try
  82. {
  83. ToLua.CheckArgsCount(L, 2);
  84. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  85. byte[] arg1 = ToLua.CheckByteBuffer(L, 2);
  86. byte[] o = LuaUInt64.And(arg0, arg1);
  87. ToLua.Push(L, o);
  88. return 1;
  89. }
  90. catch (Exception e)
  91. {
  92. return LuaDLL.toluaL_exception(L, e);
  93. }
  94. }
  95. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  96. static int Or(IntPtr L)
  97. {
  98. try
  99. {
  100. ToLua.CheckArgsCount(L, 2);
  101. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  102. byte[] arg1 = ToLua.CheckByteBuffer(L, 2);
  103. byte[] o = LuaUInt64.Or(arg0, arg1);
  104. ToLua.Push(L, o);
  105. return 1;
  106. }
  107. catch (Exception e)
  108. {
  109. return LuaDLL.toluaL_exception(L, e);
  110. }
  111. }
  112. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  113. static int Xor(IntPtr L)
  114. {
  115. try
  116. {
  117. ToLua.CheckArgsCount(L, 2);
  118. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  119. byte[] arg1 = ToLua.CheckByteBuffer(L, 2);
  120. byte[] o = LuaUInt64.Xor(arg0, arg1);
  121. ToLua.Push(L, o);
  122. return 1;
  123. }
  124. catch (Exception e)
  125. {
  126. return LuaDLL.toluaL_exception(L, e);
  127. }
  128. }
  129. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  130. static int FromDouble(IntPtr L)
  131. {
  132. try
  133. {
  134. ToLua.CheckArgsCount(L, 1);
  135. double arg0 = (double)LuaDLL.luaL_checknumber(L, 1);
  136. byte[] o = LuaUInt64.FromDouble(arg0);
  137. ToLua.Push(L, o);
  138. return 1;
  139. }
  140. catch (Exception e)
  141. {
  142. return LuaDLL.toluaL_exception(L, e);
  143. }
  144. }
  145. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  146. static int ToDouble(IntPtr L)
  147. {
  148. try
  149. {
  150. ToLua.CheckArgsCount(L, 1);
  151. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  152. double o = LuaUInt64.ToDouble(arg0);
  153. LuaDLL.lua_pushnumber(L, o);
  154. return 1;
  155. }
  156. catch (Exception e)
  157. {
  158. return LuaDLL.toluaL_exception(L, e);
  159. }
  160. }
  161. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  162. static int ToString(IntPtr L)
  163. {
  164. try
  165. {
  166. int count = LuaDLL.lua_gettop(L);
  167. if (count == 1 && TypeChecker.CheckTypes<byte[]>(L, 1))
  168. {
  169. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  170. string o = LuaUInt64.ToString(arg0);
  171. LuaDLL.lua_pushstring(L, o);
  172. return 1;
  173. }
  174. else if (count == 1 && TypeChecker.CheckTypes<LuaUInt64>(L, 1))
  175. {
  176. LuaUInt64 obj = (LuaUInt64)ToLua.ToObject(L, 1);
  177. string o = obj.ToString();
  178. LuaDLL.lua_pushstring(L, o);
  179. return 1;
  180. }
  181. else
  182. {
  183. return LuaDLL.luaL_throw(L, "invalid arguments to method: LuaUInt64.ToString");
  184. }
  185. }
  186. catch (Exception e)
  187. {
  188. return LuaDLL.toluaL_exception(L, e);
  189. }
  190. }
  191. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  192. static int UInt64ToBytes(IntPtr L)
  193. {
  194. try
  195. {
  196. ToLua.CheckArgsCount(L, 1);
  197. ulong arg0 = LuaDLL.tolua_checkuint64(L, 1);
  198. byte[] o = LuaUInt64.UInt64ToBytes(arg0);
  199. ToLua.Push(L, o);
  200. return 1;
  201. }
  202. catch (Exception e)
  203. {
  204. return LuaDLL.toluaL_exception(L, e);
  205. }
  206. }
  207. [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
  208. static int BytesToUInt64(IntPtr L)
  209. {
  210. try
  211. {
  212. ToLua.CheckArgsCount(L, 1);
  213. byte[] arg0 = ToLua.CheckByteBuffer(L, 1);
  214. ulong o = LuaUInt64.BytesToUInt64(arg0);
  215. LuaDLL.tolua_pushuint64(L, o);
  216. return 1;
  217. }
  218. catch (Exception e)
  219. {
  220. return LuaDLL.toluaL_exception(L, e);
  221. }
  222. }
  223. }