static int lua_Technique_getId(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { Technique* instance = getInstance(state); const char* result = instance->getId(); // Push the return value onto the stack. lua_pushstring(state, result); return 1; } lua_pushstring(state, "lua_Technique_getId - Failed to match the given parameters to a valid function signature."); lua_error(state); break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; }
Technique* Material::getTechnique(const char* id) const { for (unsigned int i = 0, count = _techniques.size(); i < count; ++i) { Technique* t = _techniques[i]; if (strcmp(t->getId(), id) == 0) { return t; } } return NULL; }