| 290 | |
| 291 | #ifndef EMMY_USE_LUA_SOURCE |
| 292 | void DisplayFunction54(Idx<Variable> variable, lua_State *L, int index, lua_Debug_54 &ar) { |
| 293 | if (ar.what == nullptr) { |
| 294 | return; |
| 295 | } |
| 296 | std::string what = ar.what; |
| 297 | if (what == "Lua") { |
| 298 | auto paramNum = ar.nparams > 10 ? 10 : ar.nparams; |
| 299 | std::string showValue = "function("; |
| 300 | lua_pushvalue(L, index); |
| 301 | for (auto i = 0; i != paramNum; i++) { |
| 302 | auto paramIndex = i + 1; |
| 303 | auto paramName = lua_getlocal(L, nullptr, paramIndex); |
| 304 | if (paramName) { |
| 305 | showValue.append(paramName); |
| 306 | if (paramIndex != paramNum) { |
| 307 | showValue.append(", "); |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | showValue.push_back(')'); |
| 312 | variable->value = showValue; |
| 313 | variable->valueType = 9; |
| 314 | variable->valueTypeName = "function"; |
| 315 | // ptr |
| 316 | auto ptr = variable.GetArena()->Alloc(); |
| 317 | ptr->nameType = LUA_TSTRING; |
| 318 | ptr->valueType = LUA_TFUNCTION; |
| 319 | ptr->name = "pointer"; |
| 320 | ptr->value = ToPointer(L, index); |
| 321 | |
| 322 | // source |
| 323 | if (ar.source) { |
| 324 | std::string sourceText = ar.source; |
| 325 | if (!sourceText.empty() && sourceText.front() == '@') { |
| 326 | sourceText = sourceText.substr(1); |
| 327 | } |
| 328 | auto source = variable.GetArena()->Alloc(); |
| 329 | source->nameType = LUA_TSTRING; |
| 330 | source->valueType = LUA_TSTRING; |
| 331 | source->name = "source"; |
| 332 | source->value = sourceText.append(":").append(std::to_string(ar.linedefined)); |
| 333 | } |
| 334 | } else if (what == "C") { |
| 335 | variable->value = "C " + ToPointer(L, index); |
| 336 | } else { |
| 337 | variable->value = ToPointer(L, index); |
| 338 | return; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | void DisplayFunction(Idx<Variable> variable, lua_State *L, int index) { |
| 343 | lua_Debug ar{}; |
no test coverage detected