Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refrence(path)
- -- load up the refrence file
- local refFile = compiler_load_rbf([[::simulation\attrib\refrence.rbf]])
- local explodedPath = explode([[\]], path)
- local ref = refFile.GameData
- local refT = refFile._TYPE.GameData
- local returnT, TreturnT = {}, {}
- for k,v in pairs(ref) do
- returnT[k] = v
- end
- for k,v in pairs(refT) do
- TreturnT[k] = v
- end
- for i = 1, table.getn(explodedPath) do
- if type(ref[explodedPath[i]] == "table") then
- ref = ref[explodedPath[i]]
- refT = refT[explodedPath[i]]
- else
- print("false")
- end
- end
- return ref, refT
- end
- function Shorten(file)
- return file.GameData, file._TYPE.GameData
- end
- function insert_entry(path, openFile, info)
- local exist = 0
- for k,v in pairs(openFile[1]) do
- if k == info[1] then
- exist = exist + 1
- end
- end
- local name
- if exist > 0 then
- -- also search for any un-compiled tables
- while true do
- name = [[&]] .. info[1] .. [[_]] .. exist
- if not openFile[1][name] then
- break
- else
- exist = exist + 1
- end
- end
- else
- name = info[1]
- end
- openFile[1][name], openFile[2][name] = refrence(path)
- -- find out if we need to insert info into a table or just change a value
- if table.getn(info) == 2 then
- -- assosative entries do not show up, so it will be count 1 if there are assaocative entries
- openFile[1][name] = info[2]
- else
- for k,v in pairs(info) do
- if type(k) ~= "number" then
- openFile[1][name][k] = v
- if type(v) == "number" then
- openFile[2][name][k] = "int"
- end
- end
- end
- end
- end
- function explode(div, str)
- if (div=='') then return false end
- local pos,arr = 0,{}
- -- run for each divider found
- for st,sp in function() return string.find(str,div,pos,true) end do
- table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
- pos = sp + 1 -- Jump past current divider
- end
- table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
- return arr
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement