local p =
-- DEFINE LOAD_T1 FUNCTION HERE
function load_t1(t1_loaded, stuff, t1,tabletoload) if pcall(functiont1 = mw.loadData(tabletoload) end) then t1_loaded = 1 -- LOAD TABLE FIRST TIME and SET VARIABLE t1_loaded to 1 AS IT IS NOW LOADED! stuff = stuff .. "TABLE t1 is not LOADED -- LOADED TABLE t1 via function load_t1
" else error ("Unable to load table t1") -- THIS IS LUA ERROR - FAILURE FOR LOADING TABLE end return t1_loaded, stuff, t1end
-- MAIN MODULE FUNCTION HERE
function p.testloader (frame) local stuff = "" ---- RETURN SOMETHING local t1 = ---- local array for table1 local t1_loaded = 0 ---- NO TABLE 1 is NOT LOADED! local tabletoload = "Module:" .. frame.args[1] local lukfor = frame.args[2] or "" local foundit = ""
-- NOT LOADING TABLE t1 in beginning
-- DOING A LOT OF THINGS WHICH MIGHT NOT REQUIRE A TABLE BEING LOADED -- AND POSSIBLY DO A RETURN HERE -- NOT DONE YET! HMM HAS TABLE BEEN LOADED - NOW I NEED TO CHECK IF THE TABLE t1 IS LOADED OR NOT AND DO
if t1_loaded
1 then -- DO SOMETHING stuff = stuff .. "TABLE t1 IS LOADED -- DOING SOMETHING
" end -- DO SOME MORE PROCESSING MIGHT RETURN FROM HERE OR -- NOW NEED TO DO SOMETHING WITH TABLE t1 AGAIN -- DO SOME MORE PROCESSING -- NEED TO DO ONE MORE THING WITH TABLE t1 if t1_loaded
1 then stuff = stuff .. "TABLE t1 is ALREADY LOADED
" -- DO SOMETHING foundit = t1[lukfor] if foundit ~= nil then stuff = stuff .. " FOUND : " .. lukfor .. " " .. t1[lukfor] else stuff = stuff .. " - " .. lukfor .. " was NOT FOUND in TABLE: " .. tabletoload end end return stuff end
return p