Thread Tools Display Modes
01-29-11, 07:50 AM   #1
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
detect supported function

How to detect whether the function is still supported in the player's version game or not?
 
01-29-11, 09:06 AM   #2
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
why do you need to detect a players client version unless you are coding for a private server? (discussions about private servers or anything related to them is a big NO)
 
01-29-11, 09:11 AM   #3
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Simple, you just check if the function exists in the global environment and/or if the variable is a function.

I'm just wondering which function you want to know about before I give you some code.
 
01-30-11, 04:21 AM   #4
Platine
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2010
Posts: 72
Solution

I create addons that can be run on all servers - global or private. Do not I?

The solution may be a test call to a function - possible to call lua error:

MySavedVariable["isFunction"]="0";
if ( Function() ) then
MySavedVariable["isFunction"]="1";
end
 
01-30-11, 04:52 AM   #5
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Code:
local function_exists
do
	local _G = _G
	function function_exists(func)
		return _G[func] and type(_G[func]) == 'function'
	end
end
I'm still not sure what functions you want to test for however.
 
01-30-11, 05:09 AM   #6
voodoodad
Large, Friendly Letters!
 
voodoodad's Avatar
Join Date: Oct 2008
Posts: 1,632
Discussion of Private Servers, in any manner other than theoretical, is completely against our rules. We are an Official Fan Site. We follow Blizzard's rules, on top of our own rules.

Threads requesting assistance with Private Servers get locked. Repeated postings get you banned.
__________________

~ no need to make the message completely obnoxious - Cairenn
 

WoWInterface » Developer Discussions » General Authoring Discussion » detect supported function

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off