Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args={...}
- function loadFile(filename)
- fp=fs.open(filename,"r")
- lines={}
- i=1
- lines[i]=fp.readLine()
- while lines[i]~=nil do
- i=i+1
- lines[i]=fp.readLine()
- end
- return lines
- end
- function split (inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function compileObj(lines)
- v = {}
- vt = {}
- vn = {}
- f = {}
- l = {}
- print(#lines)
- for i=5, #lines do
- if string.sub(lines[i],1,2)=="v " then
- table.insert(v,split(lines[i]))
- end
- if string.sub(lines[i],1,2)=="vt" then
- table.insert(vt,split(lines[i]))
- end
- if string.sub(lines[i],1,2)=="vn" then
- table.insert(vn,split(lines[i]))
- end
- if string.sub(lines[i],1,2)=="f " then
- table.insert(f,split(lines[i]))
- end
- if string.sub(lines[i],1,2)=="l " then
- table.insert(l,split(lines[i]))
- end
- end
- end
- compileObj(loadFile(args[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement