Lua cpp expose
Exposition to Lua runtime mechanism proposition.
The user has to create an object that is LuaScriptAbleObject
, make it inherit the CRTPLuaScriptObject
class and voila.
For example, a simple FooBar examples might be:
// Default sample exposer for lua scripts
script_class (SampleObject) {
LUA_SCRIPTABLE_CLASS(SampleObject)
SampleObject() noexcept { fprintf(stderr, "CREATE SampleObject\n"); }
~SampleObject() noexcept { fprintf(stderr, "DESTROY SampleObject\n"); }
static int foo(lua_State *L) noexcept
{
SampleObject *obj = CHECK(L, 1);
double bar = luaL_checknumber(L, 2);
return 0;
}
static constexpr inline auto metaMethods = { luaRegDefaultGC, LUA_DECL_CREATE(SampleObject) };
static constexpr inline auto methods = { LUA_DECL_METHOD(SampleObject, foo) };
};
A sample file for a script can be found at utils/lua/sample-spec.lua
, this is just a proposition.
Rapports de requête de fusion
Activité
requested review from @Elliu
assigned to @martin2018
added 1 commit
- 01d09552 - [WIP] SCRIPT: Try to simplify the declaration of Lua script-able classes
added 1 commit
- d7ba5a19 - [WIP] SCRIPT: Only expose the LuaContext object outside of the scripting parts of Vivy
added 1 commit
- 42aadbca - FIX: The lua interpreter need to be linked against the math lib on UNIX
added scripting label
added 34 commits
-
42aadbca...c42f6eb7 - 29 commits from branch
master
- a2ce3086 - [WIP] SCRIPT: Try to expose an object to Lua...
- aa8349d2 - [WIP] SCRIPT: Compiling but not tested objects used to expose things to the Lua runtime
- d5d70a34 - [WIP] SCRIPT: Try to simplify the declaration of Lua script-able classes
- 38111901 - [WIP] SCRIPT: Only expose the LuaContext object outside of the scripting parts of Vivy
- 8671ee95 - FIX: The lua interpreter need to be linked against the math lib on UNIX
Afficher/masquer la liste des validations-
42aadbca...c42f6eb7 - 29 commits from branch
added suggestion label
added 1 commit
- cbbd7161 - LUA: Add a sample lua script, a proposition of how to create a script
added 41 commits
-
cbbd7161...ce6944d7 - 34 commits from branch
master
- a11880c0 - [WIP] SCRIPT: Try to expose an object to Lua...
- 3b78e64e - [WIP] SCRIPT: Compiling but not tested objects used to expose things to the Lua runtime
- b249b674 - [WIP] SCRIPT: Try to simplify the declaration of Lua script-able classes
- bbfcb2bc - [WIP] SCRIPT: Only expose the LuaContext object outside of the scripting parts of Vivy
- 1f99b421 - FIX: The lua interpreter need to be linked against the math lib on UNIX
- 95dca532 - DOC: Update the lib dependencies
- 7d64c0a5 - LUA: Add a sample lua script, a proposition of how to create a script
Afficher/masquer la liste des validations-
cbbd7161...ce6944d7 - 34 commits from branch
added 1 commit
- a0f77353 - LUA: Add a sample lua script, a proposition of how to create a script
added 1 commit
- b8be649c - SCRIPT: Lua get last error + fix API usage (to many luaL_pop) + oupsi add some left over icons...
added 1 commit
- 9bb04085 - BUILD: Remove the Lua doc folder from the repo
added 1 commit
- 21a4890b - SCRIPT: Use an iterable thing to get sub-class' methods and meta methods and...
added 1 commit
- c537cd66 - SCRIPT: Change the macro to have less to write
added 1 commit
- e27b9807 - SCRIPT: Change the macro to have less to write
added to-review label and removed suggestion label
added 30 commits
-
f545edd4...7c02cc9f - 9 commits from branch
master
- 00db15a7 - [WIP] SCRIPT: Try to expose an object to Lua...
- ba46db5e - [WIP] SCRIPT: Compiling but not tested objects used to expose things to the Lua runtime
- c78d3aa5 - [WIP] SCRIPT: Try to simplify the declaration of Lua script-able classes
- 9e4558aa - [WIP] SCRIPT: Only expose the LuaContext object outside of the scripting parts of Vivy
- bb67bab9 - FIX: The lua interpreter need to be linked against the math lib on UNIX
- be4221e5 - DOC: Update the lib dependencies
- ad751841 - LUA: Add a sample lua script, a proposition of how to create a script
- 77d9450c - BUILD: Fix some warnings
- f5fe5eeb - BUILD: Solve more warnings
- cec28e2a - BUILD: Fix the -Wweak-vtables warning
- 640ff4e2 - SCRIPT: Push the __index to link methodtable <-> metatable
- c5543c8d - SCRIPT: Lua get last error + fix API usage (to many luaL_pop) + oupsi add some left over icons...
- 6e67e14d - SCRIPT: Better debug messages
- 856ebdb3 - SCRIPT: Get the methods working, meta methods not working for now...
- ae380387 - SCRIPT: Change model script proposition capitalisation + add the parts of the lib written in Lua
- fead7ab2 - SCRIPT: Interpret the lib before the user scripts
- ec6b691c - BUILD: Remove the Lua doc folder from the repo
- 5e2ae14a - SCRIPT: Use an iterable thing to get sub-class' methods and meta methods and...
- c2c85cb5 - SCRIPT: Change the macro to have less to write
- 13fcd126 - SCRIPT: Clear the _ENV var and set it to the constructed vivy table to have a...
- 1886cd0c - SCRIPT: Setup a custom _ENV for scripts to be executed inside + protect the Vivy table
Afficher/masquer la liste des validations-
f545edd4...7c02cc9f - 9 commits from branch
marked this merge request as draft from 00db15a7
added 43 commits
-
1886cd0c...8c4f4849 - 24 commits from branch
master
- aa6bb48d - [WIP] SCRIPT: Try to expose an object to Lua...
- 02405d25 - [WIP] SCRIPT: Compiling but not tested objects used to expose things to the Lua runtime
- 38c7d972 - [WIP] SCRIPT: Try to simplify the declaration of Lua script-able classes
- 322dbeb7 - [WIP] SCRIPT: Only expose the LuaContext object outside of the scripting parts of Vivy
- e5bdc627 - FIX: The lua interpreter need to be linked against the math lib on UNIX
- 09d2d89b - DOC: Update the lib dependencies
- 0add71ca - LUA: Add a sample lua script, a proposition of how to create a script
- 3c12ba0e - SCRIPT: Push the __index to link methodtable <-> metatable
- 15d3a38a - SCRIPT: Lua get last error + fix API usage (to many luaL_pop) + oupsi add some left over icons...
- 519ddcd9 - SCRIPT: Better debug messages
- d4c5ccaf - SCRIPT: Get the methods working, meta methods not working for now...
- cd96b6ec - SCRIPT: Change model script proposition capitalisation + add the parts of the lib written in Lua
- 4dae920b - SCRIPT: Interpret the lib before the user scripts
- 60222dc0 - BUILD: Remove the Lua doc folder from the repo
- 4a12875a - SCRIPT: Use an iterable thing to get sub-class' methods and meta methods and...
- 74b12bc7 - SCRIPT: Change the macro to have less to write
- 9c0e7ba6 - SCRIPT: Clear the _ENV var and set it to the constructed vivy table to have a...
- 02f4ac7e - SCRIPT: Setup a custom _ENV for scripts to be executed inside + protect the Vivy table
- f8d83c23 - RSC: The rsc folder moved, apply change after rebase with master
Afficher/masquer la liste des validations-
1886cd0c...8c4f4849 - 24 commits from branch
added 1 commit
- 7f6c71bf - SCRIPT: The scripts will be used in a lua context owned by the script store
added 1 commit
- aab633b3 - SCRIPT: The scripts will be used in a lua context owned by the script store
added 1 commit
- b6ef9cf1 - LIB: The name of the document and the uuid are part of the abstract document...
added 1 commit
- 6f7e1179 - UI: Update tool tips and names for document views' tabs
added 1 commit
- 77648f00 - UI: Add the "any" file type filter, which is a "*.*" restricted of recognized file type
added 1 commit
- 0fd238fe - UI: Fix the getDocument in ScriptDocumentView and mark destructor "override"...
removed to-review label