NoHero
-
Posts
5 -
Joined
-
Last visited
Reputation Activity
-
NoHero reacted to Zelly in Lua question
c would be the DB if I am correct.
(not sure if this the correct format for rewriting that piece of code, but it might help you understand it)
if you do DB:Connect("dbname", "dbuser", "dbpassword", "dbhost", 3306)
then you are really doing DB.Connect(DB,"dbname", "dbuser", "dbpassword", "dbhost", 3306)
function DB.Connect(self,DBName, DBUser, DBPass, DBAddr, Port ) -- so self is actually the DB table require "luasql.mysql" self.env = assert( luasql.mysql() ) self.con = assert(self.env:connect(DBName, DBUser, DBPass, DBAddr, Port)) end Disclaimer: I do not fully understand this part of lua yet, so I may have made a mistake.
-
NoHero reacted to Sol in Lua question
'c' argument is something like a class or struct pointer like in 'C'
LUA doesn't have classes but it's something like it, also you can implement prototype of any variable to this kind of structure to keep unique variable name and get access from that self pointer.
Here is the explanation: http://www.lua.org/pil/16.1.html
-
NoHero reacted to gaoesa in LUA get XP value
Additionally, the "ps.persistant" is probably not a good way to get the score. The better way to get the XP should be to calculate "sess.skillpoints" array values together. This way it won't be necessary to check if the player is in a team, dead or if he is speccing and the returned result will be correct. The ps (playerstate) values depend a lot on what the player is doing.
-
NoHero reacted to Zelly in LUA get XP value
If I remember correctly xp will show as 0 until at least one xp is gained in the round/map. (Bugged the hell out of me when testing) This was a long time ago though when I was testing on etpub, so I am unsure if this is still the case in silent mod.