Documentation
¶
Overview ¶
Package luaf is an implementation of lua 5.4 for learning purposes and luafs 🤠. It aims to be fully feature compatible with lua 5.4 as well as additions to the standard library to make it more of an everyday use language instead of just as an embedded language.
`luaf` is still very WIP and really shouldn't be used by anyone except me and maybe people who are interested in lua implementations. `luaf` should be fully compatible with the lua APIs that are default in lua, however it will not provide the same API as the C API. It will also be able to precompile and run precompiled code however that precompiled code is not compatible with `lua`. `luac` will not be able to run code from `luaf` and vise versa. Since the point of this implementation is more for using lua than it's use in Go there is less of an emphasis on a go API though a simple API exists.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
Env is a simple mapping for what will be exposed as a global in the lua source. This can be used to expose functions values as apis. The values in keys and values should only be - int64 - float64 - string - *runtime.GoFunc (use runtime.Fn() to create them easily) So this means that to add your own api, you can just create an env
env := map[any]any{ "render": runtime.Fn("render", func(vm *runtime.VM, args []any) ([]any, error) { return nil, errors.New("not implemented") }, }
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
luaf
command
Package main is the main entrypoint to the luaf application
|
Package main is the main entrypoint to the luaf application |
src
|
|
bytecode
Package bytecode handles formatting uint32 values which have meaning for the vm.
|
Package bytecode handles formatting uint32 values which have meaning for the vm. |
conf
Package conf contains the constants that are used across packages for configuring versions and stack sizes.
|
Package conf contains the constants that are used across packages for configuring versions and stack sizes. |
lerrors
Package lerrors are a unified errors package for lua parsing and runtime so that they can be formatted in a unified way and handled in a unified way.
|
Package lerrors are a unified errors package for lua parsing and runtime so that they can be formatted in a unified way and handled in a unified way. |
lfile
Package lfile is a wrapper around os files to make them easier to use in lua.
|
Package lfile is a wrapper around os files to make them easier to use in lua. |
lstring
Package lstring is a small collection of string utilities.
|
Package lstring is a small collection of string utilities. |
lstring/pack
Package pack allows for serialization and deserialization of data into a string.
|
Package pack allows for serialization and deserialization of data into a string. |
lstring/pattern
Package pattern is the package that implements lua patterns.
|
Package pattern is the package that implements lua patterns. |
parse
Package parse contains the code that parses code text and transforms it into bytecode and constants that are able to be run in a virtual machine or translated into another format.
|
Package parse contains the code that parses code text and transforms it into bytecode and constants that are able to be run in a virtual machine or translated into another format. |
runtime
Package runtime is a stack-based register VM to run the bytecode for the parsed lua
|
Package runtime is a stack-based register VM to run the bytecode for the parsed lua |
types
Package types contains all the structures used to define types, and check them against each other.
|
Package types contains all the structures used to define types, and check them against each other. |
Click to show internal directories.
Click to hide internal directories.