Example #1
0
bool
CKLBPauseCtrl::initScript(CLuaState& lua)
{
	int argc = lua.numArgs();
	if(argc != 2) {
		return false;
	}
	const char * pause  = (lua.isNil(1)) ? NULL : lua.getString(1);
	const char * resume = (lua.isNil(2)) ? NULL : lua.getString(2);
	
	return init(NULL, pause, resume);
}
Example #2
0
bool
CKLBFormIF::updateUIElement(CLuaState& lua, int argc, int base, int subcmd, CKLBNode * pNode, int& ret, void * item, int index)
{
	CKLBUIElement * pElement = (CKLBUIElement *)pNode;
	bool result = true;
	switch(subcmd)
	{
	default:
		{
			result = updateStandardNode(lua, argc, base, subcmd, pNode, ret, item, index);
		}
		break;
	case FORM_UIE_SET_ENABLED:
		{
			if(argc != base + 1) {
				result = false;
				break;
			}
			bool enable = lua.getBool(base + 1);
			pElement->setEnabled(enable);
		}
		break;
	case FORM_UIE_GET_ENABLED:
		{
			if(argc != base) {
				result = false;
				break;
			}
			bool enable = pElement->isEnabled();
			lua.retBoolean(enable);
			ret = 1;
		}
		break;
	case FORM_UIE_SET_ASSET:
		{
			if(argc != base + 2) {
				result = false;
				break;
			}
			const char * asset = (!lua.isNil(base + 1)) ? lua.getString(base + 1) : NULL;
			const int mode = lua.getInt(base + 2);
			CKLBAsset * pAsset = updateAsset(lua, pElement, asset, (CKLBUIElement::ASSET_TYPE)mode, item);
			bool result = (!pAsset) ? false : true;
			lua.retBoolean(result);
			ret = 1;
		}
		break;
	}
	return result;
}