GE Lua Documentation

Press F to search!

convertPrefabtoJson

Definition


-- @/lua/ge/main.lua:128

function convertPrefabtoJson(filepath)
  log('I', 'convertPrefabtoJson', 'Converting cs prefab: ' .. tostring(filepath) )
  local dir, filename, ext = path.splitWithoutExt(filepath, ".prefab")
  log('I', 'convertPrefabtoJson', '  spawning prefab as = ' .. tostring(filename) )
  local csPrefab = spawnPrefab(filename, filepath, '0 0 0', '0 0 1 0', '1 1 1')
  if csPrefab then
    local newPath = dir..filename..".prefab.json"
    csPrefab:save(newPath, false)
    csPrefab:unload()
    csPrefab:delete()
  else
    log('E','', '      Could not find prefab.')
  end
end

Callers

@/lua/ge/main.lua
  for _,file in ipairs(filenames) do
    convertPrefabtoJson(file)
  end