public static int constructor(IntPtr l) { int result; try { int num = LuaDLL.lua_gettop(l); if (num == 1) { ThreadSaftyRandom o = new ThreadSaftyRandom(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } else if (num == 2) { int seed; LuaObject.checkType(l, 2, out seed); ThreadSaftyRandom o = new ThreadSaftyRandom(seed); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } else { result = LuaObject.error(l, "New object failed."); } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int Next(IntPtr l) { int result; try { int num = LuaDLL.lua_gettop(l); if (num == 1) { ThreadSaftyRandom threadSaftyRandom = (ThreadSaftyRandom)LuaObject.checkSelf(l); int i = threadSaftyRandom.Next(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } else if (num == 2) { ThreadSaftyRandom threadSaftyRandom2 = (ThreadSaftyRandom)LuaObject.checkSelf(l); int maxValue; LuaObject.checkType(l, 2, out maxValue); int i2 = threadSaftyRandom2.Next(maxValue); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i2); result = 2; } else if (num == 3) { ThreadSaftyRandom threadSaftyRandom3 = (ThreadSaftyRandom)LuaObject.checkSelf(l); int minValue; LuaObject.checkType(l, 2, out minValue); int maxValue2; LuaObject.checkType(l, 3, out maxValue2); int i3 = threadSaftyRandom3.Next(minValue, maxValue2); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i3); result = 2; } else { LuaObject.pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function Next to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int NextDouble(IntPtr l) { int result; try { ThreadSaftyRandom threadSaftyRandom = (ThreadSaftyRandom)LuaObject.checkSelf(l); double d = threadSaftyRandom.NextDouble(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, d); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }