MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / length

Method length

src/lua/LuaVector.cpp:137–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137int LuaVector::length(lua_State* L) {
138 const int count = lua_gettop(L);
139 float sum = 0.0f;
140 for (int i = 1; i <= count; i++) {
141 const float v = luaL_checkfloat(L, i);
142 sum += v * v;
143 }
144 lua_checkstack(L, 1);
145 lua_pushfloat(L, sqrtf(sum));
146 return 1;
147}
148
149
150int LuaVector::normalize(lua_State* L) {

Callers 15

enhanceMethod · 0.45
findCaseColonMethod · 0.45
indentLineMethod · 0.45
isOneLineBlockReachedMethod · 0.45
processSwitchBlockMethod · 0.45
unindentLineMethod · 0.45
sortOnLengthFunction · 0.45
findKeywordMethod · 0.45
getCurrentWordMethod · 0.45
setTranslationClassMethod · 0.45

Calls 4

luaL_checkfloatFunction · 0.85
lua_pushfloatFunction · 0.85
lua_gettopFunction · 0.50
lua_checkstackFunction · 0.50

Tested by

no test coverage detected