1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add minetest.register_lbm() to run code on block load only

This commit is contained in:
est31 2016-02-09 07:08:31 +01:00
parent 88fbe7ca1e
commit d494733839
12 changed files with 493 additions and 25 deletions

View file

@ -299,15 +299,6 @@ inline s32 mystoi(const std::string &str, s32 min, s32 max)
}
/// Returns a 64-bit value represented by the string \p str (decimal).
inline s64 stoi64(const std::string &str)
{
std::stringstream tmp(str);
s64 t;
tmp >> t;
return t;
}
// MSVC2010 includes it's own versions of these
//#if !defined(_MSC_VER) || _MSC_VER < 1600
@ -346,9 +337,22 @@ inline float mystof(const std::string &str)
#define stoi mystoi
#define stof mystof
/// Returns a value represented by the string \p val.
template <typename T>
inline T from_string(const std::string &str)
{
std::stringstream tmp(str);
T t;
tmp >> t;
return t;
}
/// Returns a 64-bit signed value represented by the string \p str (decimal).
inline s64 stoi64(const std::string &str) { return from_string<s64>(str); }
// TODO: Replace with C++11 std::to_string.
/// Returns A string representing the value \p val.
/// Returns a string representing the value \p val.
template <typename T>
inline std::string to_string(T val)
{