Example #1
0
// **********************************************
int CToolPick::luaCanPick(CLuaState &ls)
{
	//H_AUTO(R2_CToolPick_luaCanPick)
	CLuaIHM::checkArgCount(ls, "canPick", 0);
	if (_CandidateInstance) ls.push(canPick(*_CandidateInstance));
	else ls.push(false);
	return 1;
}
// *********************************************************************************************************
void CLuaEventForwarder::onTargetInstancePostHrcMove(const std::string &refMakerAttr, sint32 refMakerAttrIndex)
{
	//H_AUTO(R2_CLuaEventForwarder_onTargetInstancePostHrcMove)
	CLuaState *ls = getLua();
	if (!ls) return;
	ls->push(refMakerAttr);
	ls->push((double) refMakerAttrIndex);
	executeHandler(LuaStr_onTargetInstancePostHrcMove, 2);
}
// *********************************************************************************************************
void CLuaEventForwarder::onAttrModified(const std::string &attrName, sint32 index)
{
	//H_AUTO(R2_CLuaEventForwarder_onAttrModified)
	CLuaState *ls = getLua();
	if (!ls) return;
	ls->push(attrName);
	ls->push((double) index);
	executeHandler(LuaStr_onAttrModified, 2);
}
// *********************************************************************************************************
void CLuaEventForwarder::onTargetInstanceAttrModified(const std::string &refMakerAttr, sint32 refMakerAttrIndex, const std::string &targetAttrName, sint32 targetAttrIndex)
{
	//H_AUTO(R2_CLuaEventForwarder_onTargetInstanceAttrModified)
	CLuaState *ls = getLua();
	if (!ls) return;
	ls->push(refMakerAttr);
	ls->push((double) refMakerAttrIndex);
	ls->push(targetAttrName);
	ls->push((double) targetAttrIndex);
	executeHandler(LuaStr_onTargetInstanceAttrModified, 4);
}
// *********************************************************************************************************
void CLuaEventForwarder::onSelect(bool selected)
{
	//H_AUTO(R2_CLuaEventForwarder_onSelect)
	CLuaState *ls = getLua();
	if (!ls) return;
	ls->push(selected);
	executeHandler(LuaStr_onSelect, 1);
}
// *********************************************************************************************************
void CLuaEventForwarder::onFocus(bool focused)
{
	//H_AUTO(R2_CLuaEventForwarder_onFocus)
	CLuaState *ls = getLua();
	if (!ls) return;
	ls->push(focused);
	executeHandler(LuaStr_onFocus, 1);
}