Changeset 687 for trunk/core/luascript.c


Ignore:
Timestamp:
01/18/09 23:17:46 (4 years ago)
Author:
reyalp
Message:

make shot_histogram memory dynamic. Allocated on shot_histo_enable(1), deallocated on disable or script end.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/luascript.c

    r681 r687  
    657657  int from = (luaL_checknumber(L,1)); 
    658658  int to = (luaL_checknumber(L,2)); 
    659   if (shot_histogram_enabled) lua_pushnumber( L, (unsigned short)shot_histogram_get_range(from, to) ); 
    660   else lua_pushnumber( L, -1 ); 
     659  if (shot_histogram_isenabled()) lua_pushnumber( L, shot_histogram_get_range(from, to) ); 
     660  else lua_pushnumber( L, -1 ); // TODO should probably return nil  
    661661  return 1; 
    662662} 
     
    664664static int luaCB_shot_histo_enable( lua_State* L ) 
    665665{ 
    666   shot_histogram_enabled = luaL_checknumber( L, 1 ); 
     666  shot_histogram_set(luaL_checknumber( L, 1 )); 
    667667  return 0; 
    668668} 
Note: See TracChangeset for help on using the changeset viewer.