lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


These are the (external) changes from beta to Lua 4.0. We intend to release 
the final version by the end of October. 

* following a suggestion in the list, lua_type will return a code for the
type, instead of a string. More exactly, the new API will be
    
    /*
    ** types returned by `lua_type'
    */
    #define LUA_TNONE       (-1)
    
    #define LUA_TUSERDATA   0
    #define LUA_TNIL        1
    #define LUA_TNUMBER     2
    #define LUA_TSTRING     3
    #define LUA_TTABLE      4
    #define LUA_TFUNCTION   5
    
    int            lua_type (lua_State *L, int index);
    const char    *lua_typename (lua_State *L, int t);
    

* there is a new error code for lua_do*: LUA_ERRERR. It happens when there
is an error while Lua is running _ERRORMESSAGE.


* as anticipated in the manual, the API to the garbage collector will 
change. Instead of lua_collectgarbage, the API will have three new 
functions: 

  int lua_getgcthreshold (lua_State *L);
  - returns the current threshold for the GC (in KBytes).

  int lua_getgccount (lua_State *L);
  - returns the amount of dynamic memory in use by Lua (an approximation,
    in KBytes). When this value equals the threshold, Lua runs a GC cycle.

  void lua_setgcthreshold (lua_State *L, int newthreshold);
  - sets a new threshold, and checks whether it is time to run the GC.
    (So, lua_setgcthreshold(L, 0) forces a GC cycle, and
    lua_setgcthreshold(L, INT_MAX) stops the GC.)

* In Lua, the old `collectgarbage' will call lua_setgcthreshold, and there 
will be a new function, gcinfo, that returns the values of lua_getgccount 
and lua_getgcthreshold. Moreover, a program will not be able to set the GC 
tag method for nil from Lua.

-- Roberto