Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
small_fem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gmsh
small_fem
Commits
3eb7a332
Commit
3eb7a332
authored
4 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
LuaFunctionSpace: add __tostring function
parent
78931fd9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lua/LuaFunctionSpace.cpp
+18
-2
18 additions, 2 deletions
lua/LuaFunctionSpace.cpp
lua/LuaFunctionSpace.h
+4
-0
4 additions, 0 deletions
lua/LuaFunctionSpace.h
with
22 additions
and
2 deletions
lua/LuaFunctionSpace.cpp
+
18
−
2
View file @
3eb7a332
...
@@ -20,6 +20,7 @@ const struct luaL_Reg libsf_FunctionSpace_f[] = {
...
@@ -20,6 +20,7 @@ const struct luaL_Reg libsf_FunctionSpace_f[] = {
};
};
const
struct
luaL_Reg
libsf_FunctionSpace_m
[]
=
{
const
struct
luaL_Reg
libsf_FunctionSpace_m
[]
=
{
{
"__tostring"
,
lua_FunctionSpace_toString
},
{
"__gc"
,
lua_FunctionSpace_delete
},
{
"__gc"
,
lua_FunctionSpace_delete
},
{
NULL
,
NULL
}
{
NULL
,
NULL
}
};
};
...
@@ -136,4 +137,19 @@ int lua_FunctionSpace_delete(lua_State *L){
...
@@ -136,4 +137,19 @@ int lua_FunctionSpace_delete(lua_State *L){
return
0
;
return
0
;
}
}
int
lua_FunctionSpace_toString
(
lua_State
*
L
){
FunctionSpace
**
lua
=
(
FunctionSpace
**
)
luaL_checkudata
(
L
,
1
,
"sf.FunctionSpace"
);
lua_pushstring
(
L
,
lua_FunctionSpace_toString
(
*
lua
).
c_str
());
return
1
;
}
string
lua_FunctionSpace_toString
(
FunctionSpace
*
fs
){
stringstream
str
;
str
<<
"Function space: "
<<
fs
;
return
str
.
str
();
}
#endif
#endif
This diff is collapsed.
Click to expand it.
lua/LuaFunctionSpace.h
+
4
−
0
View file @
3eb7a332
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include
"SmallFemConfig.h"
#include
"SmallFemConfig.h"
#ifdef HAVE_LUA
#ifdef HAVE_LUA
#include
"FunctionSpace.h"
extern
"C"
{
extern
"C"
{
#include
"lua.h"
#include
"lua.h"
}
}
...
@@ -13,5 +14,8 @@ extern "C" int luaopen_libsf_functionspace(lua_State *L);
...
@@ -13,5 +14,8 @@ extern "C" int luaopen_libsf_functionspace(lua_State *L);
int
lua_FunctionSpace_new
(
lua_State
*
L
);
int
lua_FunctionSpace_new
(
lua_State
*
L
);
int
lua_FunctionSpace_delete
(
lua_State
*
L
);
int
lua_FunctionSpace_delete
(
lua_State
*
L
);
int
lua_FunctionSpace_toString
(
lua_State
*
L
);
std
::
string
lua_FunctionSpace_toString
(
sf
::
FunctionSpace
*
fs
);
#endif
#endif
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment