--- a/rts/Game/WebbarNativeEtaPolicy.h +++ b/rts/Game/WebbarNativeEtaPolicy.h @@ -590,22 +590,32 @@ local frame=Spring.GetGameFrame();assert(frame>=lastTick,'Native ETA policy rewound; replace its handle') if frame~=lastTick then eta.widget:Update(0);lastTick=frame end end +-- This result is borrowed only for the synchronous native packet copy. +local etaReadResult={frame=0,rows={},unitCount=0,featureCount=0} +local etaReadPool={} function WebbarEtaState() - local rows,unitCount,featureCount={},0,0 - -- Preserve original pairs order: label outlines/glyphs can overlap. - for kind,values in ipairs({eta.units(),eta.features()})do + local result,used,unitCount,featureCount=etaReadResult,0,0,0 + local units,features=eta.units(),eta.features() + -- Keep the original unit-then-feature and pairs ordering unchanged. + for kind=1,2 do + local values=kind==1 and units or features for id,value in pairs(values)do if kind==1 then unitCount=unitCount+1 else featureCount=featureCount+1 end if value.display then assert(type(id)=='number'and id>=0 and id<=65535 and id%1==0) assert(type(value.yoffset)=='number'and value.yoffset==value.yoffset and value.yoffset>=0 and value.yoffset<1e7) assert(value.timeLeft==nil or(type(value.timeLeft)=='number'and value.timeLeft==value.timeLeft and math.abs(value.timeLeft)<1e12)) - rows[#rows+1]={id=id,kind=kind-1,yoffset=value.yoffset,timeLeft=value.timeLeft,unknown=value.timeLeft==nil} + used=used+1 + local row=etaReadPool[used];if not row then row={};etaReadPool[used]=row end + row.id=id;row.kind=kind-1;row.yoffset=value.yoffset;row.timeLeft=value.timeLeft;row.unknown=value.timeLeft==nil + result.rows[used]=row end end end - assert(unitCount<=8192 and featureCount<=8192 and #rows<=16384,'Native ETA policy exceeds budget') - return{frame=Spring.GetGameFrame(),rows=rows,unitCount=unitCount,featureCount=featureCount} + assert(unitCount<=8192 and featureCount<=8192 and used<=16384,'Native ETA policy exceeds budget') + for i=#result.rows,used+1,-1 do result.rows[i]=nil end + result.frame=Spring.GetGameFrame();result.unitCount=unitCount;result.featureCount=featureCount + return result end )WEBBAR_ETA"; --- a/rts/Game/WebbarNativeHealthbarPolicy.h +++ b/rts/Game/WebbarNativeHealthbarPolicy.h @@ -7531,31 +7531,41 @@ for id in pairs(WG.unittrackerapi.visibleUnits)do originalBuildAdded(id)end bars:Initialize();barsReady=true;return not removed end +-- Ephemeral read result: the sole C++ consumer copies it before the next call. +-- Reuse presentation-only rows; original widget/VBO membership stays untouched. +local healthbarReadResult={frame=0,disabled=false,rows={}} +local healthbarReadPool={} +local healthbarReadGroups={{'healthBarVBO',0},{'featureHealthVBO',1},{'featureResurrectVBO',2},{'featureReclaimVBO',3}} function WebbarHealthbarState() - local result={frame=Spring.GetGameFrame(),disabled=removed,rows={}} - if removed then return result end - for _,entry in ipairs({{'healthBarVBO',0},{'featureHealthVBO',1},{'featureResurrectVBO',2},{'featureReclaimVBO',3}})do - local buffer=assert(WG.VBOTableRegistry[entry[1]]);assert(buffer.instanceStep==20 and buffer.usedElements<=65536) - for i=1,buffer.usedElements do - local key,id=assert(buffer.indextoInstanceID[i]),nil - if entry[2]==0 then id=tonumber(key:match('^(%d+)_'))else id=key end - assert(type(id)=='number'and id>=0 and id%1==0) - local row={id=id,kind=entry[2],key=key,params={},uniforms={}} - local offset=(i-1)*20;for j=1,16 do row.params[j]=buffer.instanceData[offset+j]end - local data=(entry[2]==0 and unitUniforms or featureUniforms)[id] - for j=1,16 do row.uniforms[j]=data and data[j]or 0 end - local health,maxHealth - if entry[2]==0 then health,maxHealth=Spring.GetUnitHealth(id)else health,maxHealth=Spring.GetFeatureHealth(id)end - if health and maxHealth and maxHealth>0 then row.health={maxHealth,health} - elseif row.params[7]<20 then - -- No health read is published for hidden-damage units. This neutral pair - -- is unused by a non-health bar, whose original shader selects uniforms. - row.health={1,0} + local result=healthbarReadResult + result.frame=Spring.GetGameFrame();result.disabled=removed + local used=0 + if not removed then + for _,entry in ipairs(healthbarReadGroups)do + local buffer=assert(WG.VBOTableRegistry[entry[1]]);assert(buffer.instanceStep==20 and buffer.usedElements<=65536) + for i=1,buffer.usedElements do + local key,id=assert(buffer.indextoInstanceID[i]),nil + if entry[2]==0 then id=tonumber(key:match('^(%d+)_'))else id=key end + assert(type(id)=='number'and id>=0 and id%1==0) + local row=healthbarReadPool[used+1] + if not row then row={params={},uniforms={},health={}};healthbarReadPool[used+1]=row end + row.id=id;row.kind=entry[2];row.key=key + local offset=(i-1)*20;for j=1,16 do row.params[j]=buffer.instanceData[offset+j]end + local data=(entry[2]==0 and unitUniforms or featureUniforms)[id] + for j=1,16 do row.uniforms[j]=data and data[j]or 0 end + local health,maxHealth + if entry[2]==0 then health,maxHealth=Spring.GetUnitHealth(id)else health,maxHealth=Spring.GetFeatureHealth(id)end + if health and maxHealth and maxHealth>0 then row.health[1]=maxHealth;row.health[2]=health + elseif row.params[7]<20 then row.health[1]=1;row.health[2]=0 + else health=nil end + if (health and maxHealth and maxHealth>0)or row.params[7]<20 then + used=used+1;assert(used<=65536);result.rows[used]=row + end end - if row.health then result.rows[#result.rows+1]=row end end end - assert(#result.rows<=65536);return result + for i=#result.rows,used+1,-1 do result.rows[i]=nil end + return result end --- a/rts/Game/WebbarNativeScumPolicy.h +++ b/rts/Game/WebbarNativeScumPolicy.h @@ -5387,11 +5387,19 @@ GG.NightFactor=factor original:SunChanged() end +local disabledScumRead={disabled=true,frame=0,rows={},grass={}} +local emptyScumRead={disabled=false,frame=0,rows={},grass={}} function WebbarRaptorScumState(draw) - if not enabled then return{disabled=true,frame=Spring.GetGameFrame(),rows={},grass={}}end + if not enabled then disabledScumRead.frame=Spring.GetGameFrame();return disabledScumRead end if draw~=false then original:DrawWorldPreUnit()end local v=assert(WG.VBOTableRegistry.scumVBO) assert(v.instanceStep==8 and v.usedElements<=131072) + -- C++ copies this result synchronously. An empty queue has no drain work; + -- leave pending grass and every nonempty VBO on the original path below. + if v.usedElements==0 and next(grass)==nil then + emptyScumRead.frame=Spring.GetGameFrame();emptyScumRead.night=nightFactor;emptyScumRead.config=shaderConfig + return emptyScumRead + end local rows={} for i=1,v.usedElements do local row={} --- a/rts/Game/WebbarNativeSensorGroupsPolicy.h +++ b/rts/Game/WebbarNativeSensorGroupsPolicy.h @@ -6386,21 +6386,31 @@ for _,entry in ipairs(sensors)do sensorCall(entry.widget,'Initialize')end return not removedWidgets[tracker] end +-- Ephemeral read result: native Groups copies each value synchronously. +local sensorReadResult={frame=0,groups={}} +local sensorReadPools={} function WebbarSensorGroupsState() - local result={frame=Spring.GetGameFrame(),groups={}} + local result=sensorReadResult;result.frame=Spring.GetGameFrame() for index,entry in ipairs(sensors)do + local group=result.groups[index] + if not group then group={kind=entry.kind,rows={}};result.groups[index]=group;sensorReadPools[index]={}end local disabled=removedWidgets[tracker]or removedWidgets[entry.widget]or false local api=WG[entry.kind..'range'] - local group={kind=entry.kind,disabled=disabled,opacity=not disabled and api and api.getOpacity()or 0,rows={}} - result.groups[index]=group + group.disabled=disabled;group.opacity=not disabled and api and api.getOpacity()or 0 + local used=0 if not disabled then local buffer=assert(WG.VBOTableRegistry[entry.kind..'rangeVBO']) assert(buffer.usedElements<=65536 and buffer.instanceStep==8) - for i=1,buffer.usedElements do - local id=assert(buffer.indextoInstanceID[i]);local offset=(i-1)*8 - group.rows[i]={id=id,params={buffer.instanceData[offset+1],buffer.instanceData[offset+2],buffer.instanceData[offset+3],buffer.instanceData[offset+4]}} + used=buffer.usedElements + for i=1,used do + local row=sensorReadPools[index][i] + if not row then row={params={}};sensorReadPools[index][i]=row end + row.id=assert(buffer.indextoInstanceID[i]);local offset=(i-1)*8 + for j=1,4 do row.params[j]=buffer.instanceData[offset+j]end + group.rows[i]=row end end + for i=#group.rows,used+1,-1 do group.rows[i]=nil end end return result end --- a/rts/Game/WebbarReports.h +++ b/rts/Game/WebbarReports.h @@ -5,6 +5,8 @@ // live modifiers (WRX1), engine heap attribution and game speed. Unsynced // observation only; never changes simulation state. #include +#include "Lua/LuaHandle.h" +#include "System/UnorderedSet.hpp" #include #include "Sim/Misc/TeamStatistics.h" #include "Sim/Units/UnitMemPool.h" @@ -155,9 +157,37 @@ MAIN_THREAD_EM_ASM({ if (Module['webbarUnitModifiers']) Module['webbarUnitModifiers'](HEAPU8.slice($0, $0 + $1).buffer); }, packet.data(), packet.size()); } +// Optional low-rate diagnostic. Names/addresses are private WASM handle identities. +// Read allocation counters and GCCOUNT only; never force or schedule collection. +static void PublishWebbarLuaOwners() +{ + if(std::getenv("WEBBAR_LUA_MEMORY_OWNERS")==nullptr)return; + extern const spring::unsynced_set* LUAHANDLE_CONTEXTS[2]; + constexpr unsigned maximum=128;unsigned count=0;bool truncated=false; + LOG("[WebbarLuaOwnerBegin] frame=%d maximum=%u",gs->frameNum,maximum); + for(unsigned synced=0;synced<2;++synced){ + for(const luaContextData* context:*LUAHANDLE_CONTEXTS[synced]){ + if(count==maximum){truncated=true;break;} + if(context==nullptr||context->owner==nullptr)continue; + lua_State* state=context->owner->GetLuaGCState();if(state==nullptr)continue; + lua_lock(state); + const int gcKiB=lua_gc(state,LUA_GCCOUNT,0); + const auto bytes=context->allocState.allocedBytes.load(std::memory_order_relaxed); + const auto allocations=context->allocState.numLuaAllocs.load(std::memory_order_relaxed); + const float load=context->gcCtrl.baseMemLoadMult,runtime=context->gcCtrl.baseRunTimeMult; + const int steps=context->gcCtrl.numStepsPerIter; + lua_unlock(state); + LOG("[WebbarLuaOwner] frame=%d id=%u synced=%u bytes=%llu allocations=%llu gcKiB=%d load=%.3f runtime=%.3f steps=%d name=%s",gs->frameNum,unsigned(reinterpret_cast(context)),synced,static_cast(bytes),static_cast(allocations),gcKiB,load,runtime,steps,context->owner->GetName().c_str()); + ++count; + } + } + LOG("[WebbarLuaOwnerEnd] frame=%d count=%u truncated=%u",gs->frameNum,count,unsigned(truncated)); +} + // Heap attribution (dlmalloc mallinfo + simulation object pools). QTPFS layers are not included. static void PublishWebbarEngineMemory() { + PublishWebbarLuaOwners(); const struct mallinfo info = mallinfo(); const double values[] = {double(gs->frameNum), double(emscripten_get_heap_size()), double(info.arena), double(info.uordblks), double(info.fordblks), double(info.keepcost), double(unitMemPool.alloc_size()), double(unitMemPool.freed_size()), double(featureMemPool.alloc_size()), double(featureMemPool.freed_size()), --- a/rts/Game/WebbarExplosionDecalPolicy.h +++ b/rts/Game/WebbarExplosionDecalPolicy.h @@ -4506,6 +4506,49 @@ } end end +-- Preserve original area admission/removal arithmetic and all historical IDs. +-- The widget only indexes these private maps; it never iterates their entries. +function widget:WebbarUseDenseDecalAreas() + if self._webbarDenseDecalAreas then return end + local create=WebbarCreateDecalNumericStore + local values,overflow=type(create)=='function'and create()or{},{} + for hash,cell in pairs(areaDecals)do + for id,value in pairs(cell.instanceIDs)do + if decalToArea[id]==hash then values[id]=value + else local extra=overflow[id];if not extra then extra={};overflow[id]=extra end;extra[hash]=value end + end + end + for hash,cell in pairs(areaDecals)do + cell.instanceIDs=setmetatable({}, { + __index=function(_,id) + if decalToArea[id]==hash then return values[id]end + local extra=overflow[id];return extra and extra[hash] + end, + __newindex=function(_,id,value) + local owner=decalToArea[id] + if owner==hash then values[id]=value;return end + local extra=overflow[id] + if value==nil then if extra then extra[hash]=nil end;return end + if owner~=nil and values[id]~=nil then + if not extra then extra={};overflow[id]=extra end + extra[owner]=values[id] + end + if extra then extra[hash]=nil end + values[id]=value + -- Original AddDecalToArea makes this same assignment after adding the + -- numeric area. No callback or observation occurs between those writes. + decalToArea[id]=hash + end, + }) + end + if type(create)=='function'then + local owners=create();for id,owner in pairs(decalToArea)do owners[id]=owner end + decalToArea=owners + end + self._webbarDenseDecalAreas={values=values,overflow=overflow} +end +-- Private borrow for storage retirement after the unchanged GameFrame returns. +function widget:WebbarBorrowDecalRemovalList()return decalRemoveList end return widget end)() local explosionRelay=(function()local gadget={} @@ -4698,6 +4741,8 @@ end return gadget end)() +local retireDecalStorage=WebbarResetDecalInstanceMap +local nativeReadResult={} for _,name in ipairs({'VisibleExplosion','UnitScriptDecal'})do globals[name]=function(...)return stock[name](stock,...)end end @@ -4707,10 +4752,19 @@ if saved or graphics.config then stock:SetConfigData(saved or graphics.config)end stock:Initialize() if removed then return false end + stock:WebbarUseDenseDecalAreas() explosionRelay:Initialize();footprintRelay:Initialize();ready=true return true end, - GameFrame=function(frame)if ready then stock:GameFrame(frame)end end, + GameFrame=function(frame) + if ready then + if retireDecalStorage and frame%67==0 then + local previous=stock:WebbarBorrowDecalRemovalList() + stock:GameFrame(frame) + if not rawequal(previous,stock:WebbarBorrowDecalRemovalList())then retireDecalStorage(previous)end + else stock:GameFrame(frame)end + end + end, PlayerChanged=function(player) if not ready then return end explosionRelay:PlayerChanged(player);footprintRelay:PlayerChanged(player) @@ -4723,7 +4777,8 @@ assert(ready and not removed,'Original decal host unavailable') -- Borrow the unchanged original VBO storage for this synchronous native read. -- The native reader validates counts, stride and finite active values. - return {frame=Spring.GetGameFrame(),version=WG.decalsgl4.GetVersion(),groups=WG.decalsgl4.GetVBOData()} + nativeReadResult.frame=Spring.GetGameFrame();nativeReadResult.version=WG.decalsgl4.GetVersion();nativeReadResult.groups=WG.decalsgl4.GetVBOData() + return nativeReadResult end, State=function() assert(ready and not removed,'Original decal host unavailable') @@ -4772,4 +4827,22 @@ function WebbarExplosionDecalStandaloneNativeState()return standaloneDecals.NativeState()end +;if type(WebbarResetDecalInstanceMap)=='function' then (function() +-- Native private storage only. All compaction remains in the original callback. +return function(storage) + local original=assert(storage.compactInstanceVBO) + local function retired(t,vbo,removals,keeps) + return not rawequal(t,vbo.indextoInstanceID)and not rawequal(t,vbo.instanceIDtoIndex)and not rawequal(t,vbo.instanceData)and not rawequal(t,removals)and not rawequal(t,keeps) + end + storage.compactInstanceVBO=function(vbo,removals,keeps) + local indices,ids=vbo.indextoInstanceID,vbo.instanceIDtoIndex + local count=original(vbo,removals,keeps) + if retired(indices,vbo,removals,keeps)then WebbarResetDecalInstanceMap(indices)end + if not rawequal(indices,ids)and retired(ids,vbo,removals,keeps)then WebbarResetDecalInstanceMap(ids)end + return count + end + return original +end +end)()(gl.InstanceVBOTable) end + )WEBBAR_DECALS"; --- a/rts/Game/WebbarNativeExplosionDecals.h +++ b/rts/Game/WebbarNativeExplosionDecals.h @@ -38,6 +38,8 @@ #undef DECAL_READ } lua_settop(L,0); + if(ready)WebbarDecalCompaction::Install(L); + if(ready)WebbarDecalNumericStore::Install(L); if(ready)ready=LoadCode(L,WEBBAR_EXPLOSION_DECAL_POLICY,"Original BAR persistent decal policy"); if(ready){ std::string config; --- a/rts/Game/WebbarLuaNumericArray.h +++ b/rts/Game/WebbarLuaNumericArray.h @@ -27,3 +27,135 @@ return true; } } + +#include "LuaUser.h" +/* Private numeric-map capacity reset for the pinned Recoil Lua 5.1 ABI. + * No collection, collector setting, simulation read/write or native row change. */ +#pragma once +#include "lua.h" +#include "lauxlib.h" +#include "lib/lua/src/lobject.h" +#include "lib/lua/src/lstate.h" +#include "lib/lua/src/lmem.h" +#include "lib/lua/src/ltable.h" +namespace WebbarDecalCompaction { +static constexpr const char* EmptyKey="WebbarDecalCompactionEmptyTemplate"; +static int ResetNumericMap(lua_State* L) { + if(!lua_istable(L,1)){lua_pushboolean(L,false);return 1;} + if(lua_getmetatable(L,1)){lua_pop(L,1);lua_pushboolean(L,false);return 1;} + lua_getfield(L,LUA_REGISTRYINDEX,EmptyKey); + if(!lua_istable(L,-1)){lua_pop(L,1);lua_pushboolean(L,false);return 1;} + auto* table=static_cast(const_cast(lua_topointer(L,1))); + const auto* empty=static_cast(lua_topointer(L,-1)); + lua_pop(L,1); + lua_lock(L); + bool numeric=true; + for(int i=0;isizearray&&numeric;++i)numeric=ttisnil(table->array+i)||ttisnumber(table->array+i)||ttisboolean(table->array+i); + if(table->node!=empty->node)for(int i=0;inode+i; + if(!ttisnil(gval(n)))numeric=(ttisnumber(gval(n))||ttisboolean(gval(n)))&&ttisnumber(key2tval(n)); + } + if(numeric){ + // Match luaH_free's backing-array releases, preserving the rooted table's + // GC header and list links. Primitive slots have no outgoing GC references. + // The resulting layout matches luaH_new(L,0,0) before ordered reinsertion. + if(table->node!=empty->node)luaM_freearray(L,table->node,sizenode(table),Node); + luaM_freearray(L,table->array,table->sizearray,TValue); + table->array=nullptr;table->sizearray=0; + table->node=empty->node;table->lsizenode=empty->lsizenode;table->lastfree=empty->lastfree;table->flags=empty->flags; + } + lua_unlock(L); + lua_pushboolean(L,numeric);return 1; +} +static void Install(lua_State* L) { + static_assert(LUA_VERSION_NUM==501);static_assert(sizeof(lua_Number)==sizeof(float)); + lua_newtable(L);lua_setfield(L,LUA_REGISTRYINDEX,EmptyKey); + lua_pushcfunction(L,ResetNumericMap);lua_setglobal(L,"WebbarResetDecalInstanceMap"); +} +} + +/* Private numeric history storage for the dedicated original decal VM. + * Ordinary Lua-owned userdata pages preserve float values and nil separately. + * All keys/values outside the dense numeric domain use an ordinary Lua table. + * No collector policy, history, admission or simulation change. */ +#pragma once +#include +#include +#include +#include +#include +#include "lua.h" +#include "lauxlib.h" +namespace WebbarDecalNumericStore { +static constexpr uint32_t PageBits=12,PageSize=1u<MaxDenseKey||std::floor(key)!=key)return false; + id=uint32_t(key)-1;return true; +} +static int Read(lua_State* L) { + lua_pushvalue(L,2);lua_rawget(L,lua_upvalueindex(2)); + if(!lua_isnil(L,-1))return 1; + lua_pop(L,1);uint32_t id; + if(!Key(L,id)){lua_pushnil(L);return 1;} + lua_rawgeti(L,lua_upvalueindex(1),int((id>>PageBits)+1)); + const auto* page=static_cast(lua_touserdata(L,-1)); + const uint32_t offset=id&(PageSize-1); + if(page&&(page->present[offset>>5]&(1u<<(offset&31))))lua_pushnumber(L,page->values[offset]); + else lua_pushnil(L); + return 1; +} +static int Write(lua_State* L) { + uint32_t id; + if(!Key(L,id)){ + lua_pushvalue(L,2);lua_pushvalue(L,3);lua_rawset(L,lua_upvalueindex(2));return 0; + } + const bool number=lua_type(L,3)==LUA_TNUMBER,missing=lua_isnil(L,3); + lua_pushvalue(L,2);if(number||missing)lua_pushnil(L);else lua_pushvalue(L,3); + lua_rawset(L,lua_upvalueindex(2)); + const int pageId=int((id>>PageBits)+1);lua_rawgeti(L,lua_upvalueindex(1),pageId); + auto* page=static_cast(lua_touserdata(L,-1)); + if(!page&&number){ + lua_pop(L,1);page=static_cast(lua_newuserdata(L,sizeof(Page))); + std::memset(page->present,0,sizeof(page->present)); + lua_pushvalue(L,-1);lua_rawseti(L,lua_upvalueindex(1),pageId); + } + if(!page)return 0; + const uint32_t offset=id&(PageSize-1),mask=1u<<(offset&31);auto& word=page->present[offset>>5]; + auto* counts=static_cast(lua_touserdata(L,lua_upvalueindex(3))); + const bool was=(word&mask)!=0; + if(number){page->values[offset]=lua_tonumber(L,3);word|=mask;if(!was)++counts->numeric;} + else{word&=~mask;if(was)--counts->numeric;} + return 0; +} +static int Create(lua_State* L) { + lua_settop(L,0);lua_newtable(L);const int proxy=lua_gettop(L); + lua_newtable(L);const int pages=lua_gettop(L);lua_newtable(L);const int fallback=lua_gettop(L); + auto* counts=static_cast(lua_newuserdata(L,sizeof(Counts)));counts->numeric=0;const int stats=lua_gettop(L); + lua_newtable(L); + for(const auto entry:{std::pair{"__index",Read},{"__newindex",Write}}){ + lua_pushvalue(L,pages);lua_pushvalue(L,fallback);lua_pushvalue(L,stats); + lua_pushcclosure(L,entry.second,3);lua_setfield(L,-2,entry.first); + } + lua_pushliteral(L,"Private decal numeric history");lua_setfield(L,-2,"__metatable"); + lua_setmetatable(L,proxy);lua_settop(L,1);return 1; +} +// Count-only diagnostic; raw table iteration is deliberately not a store API. +static int Count(lua_State* L) { + if(!lua_istable(L,1)||!lua_getmetatable(L,1)){lua_pushnil(L);return 1;} + lua_getfield(L,-1,"__index");const int function=lua_gettop(L); + if(lua_tocfunction(L,function)!=Read){lua_pushnil(L);return 1;} + lua_getupvalue(L,function,3);const auto* counts=static_cast(lua_touserdata(L,-1)); + uint32_t count=counts->numeric;lua_pop(L,1);lua_getupvalue(L,function,2);lua_pushnil(L); + while(lua_next(L,-2)){++count;lua_pop(L,1);} + lua_pushnumber(L,count);return 1; +} +static void Install(lua_State* L) { + static_assert(sizeof(lua_Number)==sizeof(float)); + lua_pushcfunction(L,Create);lua_setglobal(L,"WebbarCreateDecalNumericStore"); + lua_pushcfunction(L,Count);lua_setglobal(L,"WebbarDecalNumericStoreCount"); +} +}