• 0

    posted a message on If statement help
    if you need to do that multiple times, or have some other reason to do it quickly, you could always set up another value wherever class gets assigned, like this:

    local value

    value = class == NN or class == FF or class == PP

    then you can access it later by just checking:

    if value then
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with AceDB 3.0 , Please
    Thanks for the help guys.

    I made a modified version of the copyTable function in AceDB and used it.

     
    local function copy(source)
     local newTable = {}
     
     for index, value in pairs(source) do
      newTable[index] = type(value) == "table" and copy(value) or value
     end
     
     return newTable
    end
     
    profile.config = copy(backup[name])


    Everything works perfect now.
    Thanks again.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with AceDB 3.0 , Please
    Thanks for replying.

    I'm already using AceDB, with everything set up as you posted.

    The problem is I need separate sets of pre-defined settings for the user to choose from, but they aren't all the settings of the entire profile. I only want to change the one option at a time, but retain a backup of that subset of options for the user to revert to.

    Everything worked fine before I converted it to Ace3 for the added AceDB profile handling and the configuration. Does AceDB somehow change how rawset and rawget work?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with AceDB 3.0 , Please
    I have been smacking my head for days trying to figure this problem out, please help if you can.

    I have a profile DB and also various "backups" that can be switched to.

    No matter what I do, I cannot get the profile to simply copy the data from one of the backups, it always just points to the backup instead.

    These are some examples of the test code I have tried and the comments are the results I got:

    profile = self.db.profile
     
    backup[name].color.a = 0.25
    profile.config = { color = { a = 0.5 } }
    --profile.config.color.a = 0.5
    --backup[name].color.a = 0.25
     
    <this>: profile.config = backup[name]
    <or>: rawset(profile, "config", backup[name])
    <or>: profile.config = rawget(backup, name)
    <or>: temp = rawget(backup, name)
             profile.config = temp
     
    --profile.config.color.a = 0.25
    profile.config.color.a = 0.5
    --profile.config.color.a = 0.5
    --backup[name].color.a = 0.5


    I just want to be able to change the settings of profile.config without changing the backups. Obviously the first example changed profile.config to point to the backup, but what about the others? Any ideas on why this is happening, and how to do it the way I want?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.