// Setter for component values int LuaEnv_Component::SetComponentValue(lua_State *state) { // First argument is self BaseComponent *comp = LuaEnvironment::convertUserdata<BaseComponent>(state, 1, "jl.Component"); // Second argument is value identifier std::string valueName = luaL_checkstring(state, 2); // Third values and so forth are optional arguments handled in // the component. But we will remove first and second args // to make it easier on the users end. lua_remove(state, 1); // Pop two front elements lua_remove(state, 1); comp->onLuaSet(valueName, state); return 0; }
// Setter for component values int LuaEnv_Component::SetComponentValue(LuaEnvironment &env) { // First argument is self BaseComponent *comp = env.readArg<BaseComponent*>("Saurobyte_Component"); // Second argument is value identifier std::string valueName = env.readArg<std::string>(); // Third values and so forth are optional arguments handled in // the component. But we will remove first and second args // to make it easier on the users end. //lua_remove(state, 1); // Pop two front elements //lua_remove(state, 1); comp->onLuaSet(valueName, env); return 0; }