Some usage info: FreeUserDataInTable, FreeUserData.
Name of instance of ug4-object: ug_class_name(obj) (returns "" if not a ug4 class) Check if class is base class: ug_is_base_class("BaseClass", "DerivClass") Check if dimension compiled in: ug_dim_compiled(dim) Returning metatable for a ug4-class: ug_get_metatable("ClassName")
◆ FreeUserData()
function FreeUserData |
( |
| ) |
|
sets all userdata to nil (even in tables) and calls garbage collector
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :95-111
if type(v) == "userdata" then
_G[n] = nil
end
if type(v) == "table" then
if(n ~= "_G" and n ~= "io" and n ~= "package" and n ~= "gnuplot") then
end
end
end
collectgarbage("collect")
end
function FreeUserDataInTable(t)
if(!(yy_init))
Definition: lexer.cpp:997
for(yylen=0;yystr[yylen];yylen++) continue
◆ FreeUserDataInTable()
function FreeUserDataInTable |
( |
t |
| ) |
|
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :79-92
for n,v in pairs(t) do
if type(v) == "userdata" then
t[n] = nil
end
if type(v) == "table" then
if(n ~= "_G" and n ~= "io" and n ~= "package" and n ~= "gnuplot") then
end
end
end
end
◆ ListUserData()
function ListUserData |
( |
| ) |
|
Lists all user data (even in tables)
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :63-77
if type(v) == "userdata" then
end
if type(v) == "table" then
if(n ~= "_G" and n ~= "io" and n ~= "package" and n ~= "gnuplot") then
end
end
end
end
function table print(data, style)
function ListUserDataInTable(t, name)
◆ ListUserDataInTable()
function ListUserDataInTable |
( |
t |
, |
|
|
name |
|
|
) |
| |
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :48-60
for n,v in pairs(t) do
if type(v) == "userdata" then
end
if type(v) == "table" then
if(n ~= "_G" and n ~= "io" and n ~= "package" and n ~= "gnuplot") then
end
end
end
end
location name
Definition: checkpoint_util.lua:128
References name, and print().
◆ ToUserMatrix()
function ToUserMatrix |
( |
o |
, |
|
|
my_dim |
|
|
) |
| |
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :147-178
◆ ToUserNumber()
function ToUserNumber |
( |
o |
, |
|
|
my_dim |
|
|
) |
| |
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :117-130
if my_dim == nil then my_dim =
GetUGDim() end
return _G["ConstUserNumber"..my_dim.."d"](o)
elseif type(o) == "function" then
return _G["LuaUserNumber"..my_dim.."d"](o)
elseif type(o) == "string" then
return _G["LuaUserNumber"..my_dim.."d"](_G[o]) -- we assume a function as the argument
elseif type(o) == "userdata" then -- ToDo: Provide a better condition!
return o
end
return nil -- this indicates an error
end
int GetUGDim()
returns the dimension to which UG was initialized through InitUG
Definition: bridge.cpp:205
function ToUserNumber(o, my_dim)
double number
Definition: types.h:124
◆ ToUserVector()
function ToUserVector |
( |
o |
, |
|
|
my_dim |
|
|
) |
| |
location: /home/runner/work/docs/docs/ug4/ugcore/scripts/util / user_data_util.lua :132-145
if my_dim == nil then my_dim =
GetUGDim() end
if type(o) == "table" then
return _G["ConstUserVector"..my_dim.."d"](o)
elseif type(o) == "function" then
return _G["LuaUserVector"..my_dim.."d"](o)
elseif type(o) == "string" then
return _G["LuaUserVector"..my_dim.."d"](_G[o]) -- we assume a function as the argument
elseif type(o) == "userdata" then -- ToDo: Provide a better condition!
return o
end
return nil -- this indicates an error
end
function ToUserVector(o, my_dim)