convert integer to object type name and class */ local oname,oclass = int_to_objname(25); */
| 1189 | /* convert integer to object type name and class */ |
| 1190 | /* local oname,oclass = int_to_objname(25); */ |
| 1191 | staticfn int |
| 1192 | nhl_int_to_obj_name(lua_State *L) |
| 1193 | { |
| 1194 | int argc = lua_gettop(L); |
| 1195 | |
| 1196 | if (argc == 1) { |
| 1197 | char buf[8]; |
| 1198 | lua_Integer i = luaL_checkinteger(L, 1); |
| 1199 | |
| 1200 | if (i >= 0 && i < NUM_OBJECTS && OBJ_NAME(objects[i])) { |
| 1201 | lua_pushstring(L, OBJ_NAME(objects[i])); |
| 1202 | buf[0] = def_oc_syms[(int)objects[i].oc_class].sym; |
| 1203 | buf[1] = '\0'; |
| 1204 | lua_pushstring(L, buf); |
| 1205 | } else { |
| 1206 | lua_pushstring(L, ""); |
| 1207 | lua_pushstring(L, ""); |
| 1208 | } |
| 1209 | } else |
| 1210 | nhl_error(L, "Expected an integer parameter"); |
| 1211 | return 2; |
| 1212 | } |
| 1213 | |
| 1214 | DISABLE_WARNING_UNREACHABLE_CODE |
| 1215 | /* because nhl_error() does not return */ |
nothing calls this directly
no test coverage detected