Actually.
To answer my own question, this probably suffices for most/all of my use
cases.
func LoadScript(script string) {
L := lua.NewState()
defer L.Close()
file, err := Asset(script)
if err = L.DoFile(script); err != nil {
L.DoString(string(file))
}
}
On Sunday, 26 May 2019 15:44:01 UTC+2, Mark Bauermeister wrote:
>
> My use case is a game engine that uses Lua scripts.
> Naturally, Lua scripts can be changed during runtime without rebuilding
> the entire project.
>
> Since go-bindata doesn't actually load the file during runtime but merely
> precompiles it to a string representation, it doesn't work for dynamic
> content and one of the main benefits
> of using a dynamic scripting language is lost in the process.
>
> Is there any alternative that would allow loading the files dynamically
> during development and baking them into the source upon release?
> Or am I better off just writing some custom logic that simply tries to
> load the file from the file system and, upon failing, reverts to the baked
> data?
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/9305b5d0-0f62-430d-9549-e96cc22f69af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.