tacticalweapon1 Posted August 3, 2020 Share Posted August 3, 2020 I'm trying to wrap my head around some of these declarations and functions. I will put out the two that are confusing me the most: local StalkerBrain = Class(Brain, function(self, inst) Brain._ctor(self, inst) self.abilityname = nil self.abilitydata = nil self.snaretargets = nil self.hasfeast = nil self.hasminions = nil self.checkminionstime = nil self.wantstospikes = nil end) I'm getting confused by the first bit to be honest. What's a class? Is it like a struct? local function IsDefensive(self) return self.inst.components.health.currenthealth < TUNING.STALKER_ATRIUM_PHASE2_HEALTH end I'm getting confused by a small part of the return statement. Is self a lua keyword or was it a created one? Same with inst. What exactly do self and inst refer to? Also, any resources that would be useful to understand lua better would be appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/120675-new-to-lua-and-programming-tbh-and-browsing-the-brain-for-the-ancient-fuelweaver-i-have-a-few-questions/ Share on other sites More sharing options...
penguin0616 Posted August 4, 2020 Share Posted August 4, 2020 (edited) @tacticalweapon1 Yes, class is like a struct. I'm not experienced with C, but a quick google search seems to confirm my thoughts on what a struct is. It's not really a keyword. It's mostly used in metatables to reference the object. However, it's different in that it acts like a variable. http://www.lua.org/manual/5.1/ This is quite helpful. Most of the game's code revolves around using meta tables, so I suggest you make sure you understand that section. Edited August 4, 2020 by penguin0616 1 Link to comment https://forums.kleientertainment.com/forums/topic/120675-new-to-lua-and-programming-tbh-and-browsing-the-brain-for-the-ancient-fuelweaver-i-have-a-few-questions/#findComment-1359722 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now