2014-01-24 11 views

回答

2

在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 

這實際上是5.1的Lua luaconf,但5.2 CONF應該是相似的。

+1

還有更多要改變。 – lhf

9

你需要編輯luaconf.h和更改這些:

  • LUA_NUMBERfloat
  • LUA_NUMBER_SCAN"%f"
  • LUA_NUMBER_FMT"%.7g"
  • l_mathop(x)(x##f)
  • lua_str2number使用strtof

對於最後兩個,您可能需要一個C編譯器來支持(某些)C99標準。

+0

當我將'LUA_NUMBER_SCAN'更改爲'「%.7g」'時,Visual Studio會說:'錯誤C2001:常量中有新行' –

+2

@LiessJemai,這是一個愚蠢的智能引用,請再試一次。 – lhf