ug4
common Utility

Functions

function common head (list, last)
 
function common path_sep ()
 
function common printf (s,...)
 
function common printfn (s,...)
 
function common scandir (directory_, extension_)
 
function common scandir_ugx (directory, extension)
 
function common scandir_xml (directory, extension)
 
function string split_path (sep, n)
 
function common sprintf (s,...)
 
function common sprintfn (s,...)
 
function common tail (list, first)
 

Detailed Description

Utility functions for common operations Questions? steph.nosp@m.an.g.nosp@m.rein@.nosp@m.gcsc.nosp@m..uni-.nosp@m.fran.nosp@m.kfurt.nosp@m..de

Function Documentation

◆ head()

function common head ( list  ,
last   
)

head

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :89-91

function common:head(list, last)
return { table.remove({select(1, unpack(list))}, last) }
end
function common head(list, last)

◆ path_sep()

function common path_sep ( )

returns the path separator used by the current OS

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :160-162

function common:path_sep()
return package.config:sub(1,1)
end
function common path_sep()

◆ printf()

function common printf ( s  ,
  ... 
)

unpacks a list of lists (trivial recursion to unpack all levels if needed) emulates printf

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :64-66

function common:printf(s, ...)
print(prepare(s, ...))
end
function common printf(s,...)
function table print(data, style)

Referenced by ug::bridge::CompletionFunction(), ug::bridge::GetGlobalFunctionInfo(), ug::bridge::GetMemberFunctionInfo(), ug::CUDAManager::init(), and ug::bridge::print().

◆ printfn()

function common printfn ( s  ,
  ... 
)

emulates printf with newline appended

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :69-71

function common:printfn(s, ...)
print(prepare(s .. "\n", ...))
end
function common printfn(s,...)

◆ scandir()

function common scandir ( directory_  ,
extension_   
)

lists all files in a directory, then stores it into a table

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :104-157

◆ scandir_ugx()

function common scandir_ugx ( directory  ,
extension   
)

list all ugx files

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :167-169

function common:scandir_ugx(directory, extension)
return common:scandir(directory, "ugx")
end
function common scandir(directory_, extension_)
function common scandir_ugx(directory, extension)

◆ scandir_xml()

function common scandir_xml ( directory  ,
extension   
)

list all xml files

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :174-176

function common:scandir_xml(directory, extension)
return common:scandir(directory, "xml")
end
function common scandir_xml(directory, extension)

◆ split_path()

function string split_path ( sep  ,
 
)

split filename by delimiter (defaults to slash) and takes the n-th group

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :94-99

function string:split_path(sep, n)
local sep, fields = sep or "/", {}
local pat = string.format("([^%s]+)", sep)
self:gsub(pat, function(z) fields[#fields+1] = z end)
return fields[n or #fields]
end
function string split_path(sep, n)
int local(bglp_vertex_descriptor p)
Definition: parallel_matrix.h:57

◆ sprintf()

◆ sprintfn()

function common sprintfn ( s  ,
  ... 
)

emulates sprintfn

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :79-81

function common:sprintfn(s, ...)
return prepare(s .. "\n" , ...)
end
function common sprintfn(s,...)

◆ tail()

function common tail ( list  ,
first   
)

tail

location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / common_util.lua :84-86

function common:tail(list, first)
return { select(first or 10, unpack(list)) }
end
function common tail(list, first)