flutter_lualike 0.1.0 copy "flutter_lualike: ^0.1.0" to clipboard
flutter_lualike: ^0.1.0 copied to clipboard

Flutter AssetBundle filesystem backend for lualike. Provides transparent read-only file access for dofile(), require(), io.open(), and module loading from Flutter assets. Includes a composite backend [...]

flutter_lualike #

Flutter AssetBundle filesystem backend for lualike. Provides transparent read-only file access for dofile() and module loading from Flutter assets.

Install #

dependencies:
  flutter_lualike: ^0.1.0
  lualike: ^0.3.0

Then run:

flutter pub get

Usage #

import 'package:flutter_lualike/flutter_lualike.dart';

await useAssetBundle(rootBundle, assetRoot: 'assets');

// Now dofile('config.lua') resolves to assets/config.lua

Desktop (local filesystem fallback) #

import 'package:file/local.dart';
import 'package:file_lualike/file_lualike.dart';
import 'package:flutter_lualike/flutter_lualike.dart';
import 'package:lualike/lualike.dart';

final backend = CompositeFileSystemBackend([
  AssetBundleFileSystemBackend(rootBundle, assetRoot: 'assets'),
  PackageFileSystemBackend(LocalFileSystem()),
]);
setFileSystemBackend(backend);

How it works #

Two integration points are wired when you call useAssetBundle():

  1. FileSystemProviderio.open() creates AssetBundleIODevice instances that read from the bundle (read-only, mode "r" only).

  2. FileSystemBackenddofile(), require(), os.remove() and other metadata operations delegate to AssetBundleFileSystemBackend, which resolves paths via the asset manifest.

Components #

Class Purpose
AssetBundleFileSystemBackend FileSystemBackend backed by AssetBundle + AssetManifest
AssetBundleIODevice Read-only IODevice for io.open()
useAssetBundle() One-call setup for both integration points

For writable storage, combine with CompositeFileSystemBackend from core lualike and PackageFileSystemBackend from file_lualike.

1
likes
0
points
158
downloads

Publisher

verified publisherglenfordwilliams.com

Weekly Downloads

Flutter AssetBundle filesystem backend for lualike. Provides transparent read-only file access for dofile(), require(), io.open(), and module loading from Flutter assets. Includes a composite backend that falls back to the local filesystem for desktop platforms.

Repository (GitHub)
View/report issues

Topics

#lua #scripting #flutter #asset-bundle

License

unknown (license)

Dependencies

flutter, lualike

More

Packages that depend on flutter_lualike