Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Game Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
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
Game Development
Game Library
Commits
dfa62f08
Commit
dfa62f08
authored
2 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
expose lua scripts to asset system
parent
daa97196
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integrations/lua/include/fggl/script/lua/module.hpp
+9
-2
9 additions, 2 deletions
integrations/lua/include/fggl/script/lua/module.hpp
integrations/lua/src/module.cpp
+11
-0
11 additions, 0 deletions
integrations/lua/src/module.cpp
with
20 additions
and
2 deletions
integrations/lua/include/fggl/script/lua/module.hpp
+
9
−
2
View file @
dfa62f08
...
...
@@ -23,15 +23,22 @@
#include
"fggl/entity/module.hpp"
#include
"fggl/script/engine.hpp"
#include
"fggl/data/module.hpp"
#include
"fggl/assets/packed/adapter.hpp"
namespace
fggl
::
script
::
lua
{
constexpr
auto
MIME_LUA
=
assets
::
from_mime
(
"text/lua"
);
constexpr
auto
SCRIPT_LUA
=
assets
::
make_asset_type
(
"script/lua"
);
struct
Lua
{
constexpr
static
const
char
*
name
=
"fggl::script::lua"
;
constexpr
static
const
std
::
array
<
modules
::
ModuleService
,
1
>
provides
=
{
script
::
ScriptProvider
::
service
};
constexpr
static
const
std
::
array
<
modules
::
ModuleService
,
1
>
depends
=
{
data
::
SERVICE_STORAGE
constexpr
static
const
std
::
array
<
modules
::
ModuleService
,
2
>
depends
=
{
data
::
SERVICE_STORAGE
,
assets
::
CheckinAdapted
::
service
};
static
bool
factory
(
modules
::
ModuleService
name
,
modules
::
Services
&
serviceManager
);
};
...
...
This diff is collapsed.
Click to expand it.
integrations/lua/src/module.cpp
+
11
−
0
View file @
dfa62f08
...
...
@@ -21,11 +21,22 @@
namespace
fggl
::
script
::
lua
{
static
assets
::
AssetTypeID
is_lua
(
std
::
filesystem
::
path
path
)
{
if
(
path
.
extension
()
==
".lua"
)
{
return
SCRIPT_LUA
;
}
return
assets
::
INVALID_ASSET_TYPE
;
}
bool
Lua
::
factory
(
modules
::
ModuleService
service
,
modules
::
Services
&
serviceManager
)
{
if
(
service
==
ScriptProvider
::
service
)
{
auto
storageService
=
serviceManager
.
get
<
data
::
Storage
>
();
serviceManager
.
bind
<
ScriptProvider
,
LuaScriptProvider
>
(
storageService
);
auto
*
assetPacker
=
serviceManager
.
get
<
assets
::
CheckinAdapted
>
();
assetPacker
->
setLoader
(
MIME_LUA
,
assets
::
NEEDS_CHECKIN
,
is_lua
);
return
true
;
}
...
...
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