diff options
Diffstat (limited to 'src/script/lua_api/l_noise.h')
-rw-r--r-- | src/script/lua_api/l_noise.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/script/lua_api/l_noise.h b/src/script/lua_api/l_noise.h index e958c5a23..492eb7550 100644 --- a/src/script/lua_api/l_noise.h +++ b/src/script/lua_api/l_noise.h @@ -160,4 +160,37 @@ public: static void Register(lua_State *L); }; + +/* + LuaSecureRandom +*/ +class LuaSecureRandom : public ModApiBase { +private: + static const size_t RAND_BUF_SIZE = 2048; + static const char className[]; + static const luaL_reg methods[]; + + u32 m_rand_idx; + char m_rand_buf[RAND_BUF_SIZE]; + + // Exported functions + + // garbage collector + static int gc_object(lua_State *L); + + // next_bytes(self, count) -> get count many bytes + static int l_next_bytes(lua_State *L); + +public: + bool fillRandBuf(); + + // LuaSecureRandom() + // Creates an LuaSecureRandom and leaves it on top of stack + static int create_object(lua_State *L); + + static LuaSecureRandom *checkobject(lua_State *L, int narg); + + static void Register(lua_State *L); +}; + #endif /* L_NOISE_H_ */ |