Inherit from a C++ exposed class?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Inherit from a C++ exposed class?

Postby BackRaw » Fri Aug 24, 2012 12:28 am

Hi guys,

Is there a way to inherit from a C++ exposed class in Python? Take this for example

Syntax: Select all

from Source import Player

class _Player(Player.IPlayerInfo): # or something else, I can't get an overview of the C++ sources somehow..
def __init__(self, player_edict):
Player.IPlayerInfo.__init__(self, player_edict)

# add some attributes and stuff
User avatar
Monday
Administrator
Posts: 98
Joined: Thu Jul 12, 2012 4:15 am

Postby Monday » Fri Aug 24, 2012 6:00 pm

Well you could always just test it?

If it doesnt work you could always do something like this:

Syntax: Select all

class MyPlayer(object):
def __init__(self, *args):
'''Called when a server-var is initilized.'''
self.IPlayerInfo = blah

def __getattr__(self, name):
'''Runs missing attributes and methods against IPlayerInfo instance'''
return getattr(self.IPlayerInfo, name)
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Fri Aug 24, 2012 10:11 pm

Monday wrote:Well you could always just test it?

If it doesnt work you could always do something like this:

Syntax: Select all

class MyPlayer(object):
def __init__(self, *args):
'''Called when a server-var is initilized.'''
self.IPlayerInfo = blah

def __getattr__(self, name):
'''Runs missing attributes and methods against IPlayerInfo instance'''
return getattr(self.IPlayerInfo, name)


Yeah testing would be fine but I'm in trouble installing a linux CS:GO server... can't connect to steam somehow... i'll try it out sometime later. Thanks for your answer tho =)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 11 guests