View Single Post
Old 12-17-12, 12:23 AM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,677
Your example a/b/c code will work fine, because the "b" function is defined before you try to call it in the "c" function. Your real code will not work fine, because your "RemGank_Validate_DB" function is not defined before you try to call it in your "RemGank_Record_Player" function.

You have two options:

1. Define the functions in the proper order so that each one is defined before you try to call it:

Code:
local function A() print("A") end -- create this first
local function B() return A() end -- before you call it here
2. Define all of the locals first, and then set their values in whatever order:

Code:
local A, B

function B() return A() end
function A() print("A") end
However, if you only call "RemGank_Validate_DB" from "RemGank_Record_Player" you should just get rid of the whole "RemGank_Validate_DB" function, and just put its code directly in the "RemGank_Record_Player" function.

Better yet, you should just validate your DB once when your addon loads, instead of every time you add a record.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote