Example #1
0
File: lua.c Project: Cynede/hexchat
static int api_hexchat_pluginprefs_meta_newindex(lua_State *L)
{
	script_info *script = get_info(L);
	const char *key;
	hexchat_plugin *h;

	if(!script->name)
		return luaL_error(L, "cannot use hexchat.pluginprefs before registering with hexchat.register");

	key = luaL_checkstring(L, 2);
	h = script->handle;
	switch(lua_type(L, 3))
	{
		case LUA_TSTRING:
			hexchat_pluginpref_set_str(h, key, lua_tostring(L, 3));
			return 0;
		case LUA_TNUMBER:
			hexchat_pluginpref_set_int(h, key, lua_tointeger(L, 3));
			return 0;
		case LUA_TNIL: case LUA_TNONE:
			hexchat_pluginpref_delete(h, key);
			return 0;
		default:
			return luaL_argerror(L, 3, "expected string, number, or nil");
	}
}
Example #2
0
static
XS (XS_HexChat_plugin_pref_delete)
{
	dMARK;
	dAX;
	
	XSRETURN_IV ((IV) hexchat_pluginpref_delete (ph, SvPV_nolen (ST (0))));
}
Example #3
0
static int
del_info (char const* network)
{
	return hexchat_pluginpref_delete (ph, network);
}