These are chat archives for Spring-Chobby/Chobby

27th
Jun 2016
Jose Luis
@TurBoss
Jun 27 2016 07:05
morning
Gajo Petrovic
@gajop
Jun 27 2016 07:05
hey
Jose Luis
@TurBoss
Jun 27 2016 07:06
what do you mean with widget callins?
Gajo Petrovic
@gajop
Jun 27 2016 07:07
googlefrog linked them earlier
Jose Luis
@TurBoss
Jun 27 2016 07:07
ahhh
the engine stuff?
Gajo Petrovic
@gajop
Jun 27 2016 07:07
@GoogleFrog
function widget:GetConfigData()
function widget:SetConfigData(data)
seems to be called a initialize and shutdown respectively
and stores the data in a table inside SHORTNAME_data.lua
Jose Luis
@TurBoss
Jun 27 2016 07:07
ok fine
so instead of any explicit invocation of SaveConfig, you should rely on these things
same for loading
Jose Luis
@TurBoss
Jun 27 2016 07:08
ok
so no more Configuration:save
Gajo Petrovic
@gajop
Jun 27 2016 07:10
you'd probably call it from widget:GetConfigData(), it should instead be made to return a table instead of writing to file
so widget -> core.lua -> configuration.lua
Jose Luis
@TurBoss
Jun 27 2016 07:10
but this go in the chat_windows.lua no?
Gajo Petrovic
@gajop
Jun 27 2016 07:10
no, it doesn't
Jose Luis
@TurBoss
Jun 27 2016 07:12
oh realy helpfull
Jose Luis
@TurBoss
Jun 27 2016 07:19
so gui_chili_lobby.lua should loo like this?

function widget:GetConfigData()
WG.Chobby:GetConfigData()
end

function widget:SetConfigData(data)
WG.Chobby:SetConfigData(data)
end

ah fail missing underscore
Gajo Petrovic
@gajop
Jun 27 2016 07:24
well you also need to return the data in the Get
Jose Luis
@TurBoss
Jun 27 2016 07:25
ok
Gajo Petrovic
@gajop
Jun 27 2016 07:25
so just pass whatever you got from the function you invoked
Jose Luis
@TurBoss
Jun 27 2016 07:29
function widget:GetConfigData()
    data = WG.Chobby:_GetConfigData()
    return(data)
end
plz be patient :)
Gajo Petrovic
@gajop
Jun 27 2016 07:33
return Bla() works, no need to assign it to variables
Jose Luis
@TurBoss
Jun 27 2016 07:33
ok
so in core.lua the same?
Gajo Petrovic
@gajop
Jun 27 2016 07:34
yeah
Jose Luis
@TurBoss
Jun 27 2016 07:34
and the in configuration.lua change the write file to this
no?
Gajo Petrovic
@gajop
Jun 27 2016 07:35
yep, you want to return the "out" table directly
Jose Luis
@TurBoss
Jun 27 2016 07:35
yep thats the idea no?
Gajo Petrovic
@gajop
Jun 27 2016 07:35
you don't even need to create the table explicitly just
return {
username = ...
}
should be fairly easy
Jose Luis
@TurBoss
Jun 27 2016 07:36
:D
Gajo Petrovic
@gajop
Jun 27 2016 07:36
change LoadConfig also, and remove any other mentions of :SaveConfig throughout the project
Jose Luis
@TurBoss
Jun 27 2016 07:36
ok first i'm on core.lua
Gajo Petrovic
@gajop
Jun 27 2016 07:37
ill be back in about an hour
Jose Luis
@TurBoss
Jun 27 2016 07:37
function Chobby:_GetConfigData()
    return data
end

function Chobby:_SetConfigData(data)
end
ok
Jose Luis
@TurBoss
Jun 27 2016 08:16
Hi Anarchid
Анархид
@Anarchid
Jun 27 2016 08:16
hi
Jose Luis
@TurBoss
Jun 27 2016 08:39
ok i managed to store the config and get it back
but can't figure out how to fill the login fields
Gajo Petrovic
@gajop
Jun 27 2016 08:40
you don't change the way they're filled, just don't invoke saving explicitly
Jose Luis
@TurBoss
Jun 27 2016 08:40
ok i removed the save from login
Gajo Petrovic
@gajop
Jun 27 2016 08:40
Configuration should be loaded with SetConfigData and the appropriate fields should be filled
there's a chance you may run in a race condition, where windows are created immediately upon initialize https://github.com/Spring-Chobby/Chobby/blob/master/LuaUI/widgets/chobby/core.lua#L51-L64 and the Configuration data might not be available yet
Jose Luis
@TurBoss
Jun 27 2016 08:45
posible
what can be don?
usually I prefer to explicitly delay things for the next :Update, :GameFrame, :DrawWorld or similar callins, but the current delay API (https://github.com/Spring-Chobby/Chobby/blob/master/LuaUI/widgets/api_delay.lua) uses a time-based delay instead
you should definitely use it though (or extend/improve it), as it makes code cleaner
Jose Luis
@TurBoss
Jun 27 2016 08:47
delayed 0.5 and worked like a charm
the only thing is that now channes autojoin does not work :D
Gajo Petrovic
@gajop
Jun 27 2016 08:50
a very small delay should be used, e.g. 0.001
Jose Luis
@TurBoss
Jun 27 2016 08:50
ok checking
Gajo Petrovic
@gajop
Jun 27 2016 08:50
this basically tells it to do it the next :Update frame which is what you really want
the next :Update will be invoked after :SetConfigData which is all that matters
Jose Luis
@TurBoss
Jun 27 2016 08:51
ok fine
I made a PR for review
Gajo Petrovic
@gajop
Jun 27 2016 09:01
ok think i mentioned everything
Jose Luis
@TurBoss
Jun 27 2016 09:05
ok fixed everything you mentioned
but can't still joind saved channels
Gajo Petrovic
@gajop
Jun 27 2016 09:05
last thing too?
Jose Luis
@TurBoss
Jun 27 2016 09:05
checking
Gajo Petrovic
@gajop
Jun 27 2016 09:07
added some other comments
Jose Luis
@TurBoss
Jun 27 2016 09:07
fine
Gajo Petrovic
@gajop
Jun 27 2016 09:07
before i merge this you'll need to squash all commits into one
also review it yourself here (https://github.com/Spring-Chobby/Chobby/pull/32/files) before asking me; most of my comments are obvious things
Jose Luis
@TurBoss
Jun 27 2016 09:08
:)
but the most important thing
I'm stil unable to join the stored channels
:(
oh they are working
:D
Gajo Petrovic
@gajop
Jun 27 2016 09:11
this seems wrong:
channels = Configuration:GetChannels() for k, v in pairs(channels) do lobby:Join(v) end
when i said you shouldn't localize, i meant that you can put the Configuration:GetChanenls() inside the pairs directly
not that you shouldn't write the "local" variable
Jose Luis
@TurBoss
Jun 27 2016 09:12
ahh
sry
Gajo Petrovic
@gajop
Jun 27 2016 09:12
it's usually best to define as few variables as possible as it helps with code readability
Jose Luis
@TurBoss
Jun 27 2016 09:13
for _, v in pairs(Configuration:GetChanenls()) do
fine?
Gajo Petrovic
@gajop
Jun 27 2016 09:13
yes
Jose Luis
@TurBoss
Jun 27 2016 09:14
ok now time to squash
Gajo Petrovic
@gajop
Jun 27 2016 09:15
you have one more whitespace error and i still want you to rename the : SaveConfig and : LoadConfig functions
call them GetConfigData and SetConfigData to match the widget callins (it'll be more clear what it means then)
Jose Luis
@TurBoss
Jun 27 2016 09:16
ok
Gajo Petrovic
@gajop
Jun 27 2016 09:17
after you've done that, i suggest these two issues if you have no further ideas on your own: Spring-Chobby/Chobby#10 and Spring-Chobby/Chobby#35
i gtg now, be back in 3hs; i'll merge your PR once I get back if it's in order
Jose Luis
@TurBoss
Jun 27 2016 09:20
cu
Jose Luis
@TurBoss
Jun 27 2016 15:45
hio
I'm working on #10
Gajo Petrovic
@gajop
Jun 27 2016 15:55
that's good, i'm super busy for the next 3 days, so might not be able to give you as detailed reviews immediately