
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
github.com/yuin/gluamapper
.. image:: https://godoc.org/github.com/yuin/gluamapper?status.svg :target: http://godoc.org/github.com/yuin/gluamapper
.. image:: https://travis-ci.org/yuin/gluamapper.svg :target: https://travis-ci.org/yuin/gluamapper
|
gluamapper provides an easy way to map GopherLua tables to Go structs.
gluamapper converts a GopherLua table to map[string]interface{}
, and then converts it to a Go struct using mapstructure <https://github.com/mitchellh/mapstructure/>
_ .
.. code-block:: bash
go get github.com/yuin/gluamapper
See Go doc <http://godoc.org/github.com/yuin/gluamapper>
_ .
.. code-block:: go
type Role struct {
Name string
}
type Person struct {
Name string
Age int
WorkPlace string
Role []*Role
}
L := lua.NewState()
if err := L.DoString(`
person = {
name = "Michel",
age = "31", -- weakly input
work_place = "San Jose",
role = {
{
name = "Administrator"
},
{
name = "Operator"
}
}
}
`); err != nil {
panic(err)
}
var person Person
if err := gluamapper.Map(L.GetGlobal("person").(*lua.LTable), &person); err != nil {
panic(err)
}
fmt.Printf("%s %d", person.Name, person.Age)
MIT
Yusuke Inuzuka
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.