I want that lua_number gets a float instead of a double. I know that I have to change something in luaconf.h but I dont know what. I am using Lua 5.2.3 and Visual Studio C++.
2 Answers
You need to edit luaconf.h and change these:
LUA_NUMBERtofloatLUA_NUMBER_SCANto"%f"LUA_NUMBER_FMTto"%.7g"l_mathop(x)to(x##f)lua_str2numberto usestrtof
For the last two, you probably need a C compiler that supports (some of) the C99 standard.
-
When I change
LUA_NUMBER_SCANto"%.7g”, Visual Studio says:error C2001: new line in constant.– user2630015Jan 24, 2014 at 17:19 -
In luaconf.h
/*
** {==================================================================
@@ LUA_NUMBER is the type of numbers in Lua.
** CHANGE the following definitions only if you want to build Lua
** with a number type different from double. You may also need to
** change lua_number2int & lua_number2integer.
** ===================================================================
*/
#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER double
This is actually the Lua 5.1 luaconf, but the 5.2 conf should be similar.
-
1