diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-05-28 23:16:55 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-05-28 23:16:55 +0200 |
commit | f0318bd020abe57c0cf365b0479b5d14b95ff07a (patch) | |
tree | ed2d89cda1adeb6f3ed6a6da98e054e2b7519c37 /types.go | |
parent | fea98ddbbe886845ed41ab87d9a2d24323c8de82 (diff) | |
download | hydra-dragonfire-f0318bd020abe57c0cf365b0479b5d14b95ff07a.tar.xz |
Migrate to gopher-lua
Diffstat (limited to 'types.go')
-rw-r--r-- | types.go | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/types.go b/types.go deleted file mode 100644 index 0fe1cad..0000000 --- a/types.go +++ /dev/null @@ -1,83 +0,0 @@ -package main - -import ( - "github.com/Shopify/go-lua" - "github.com/anon55555/mt" - "image/color" -) - -//go:generate ./mkconvert.lua - -func luaPushVec2(l *lua.State, val [2]float64) { - l.Global("vec2") - l.PushNumber(val[0]) - l.PushNumber(val[1]) - l.Call(2, 1) -} - -func luaPushVec3(l *lua.State, val [3]float64) { - l.Global("vec3") - l.PushNumber(val[0]) - l.PushNumber(val[1]) - l.PushNumber(val[2]) - l.Call(3, 1) -} - -func luaPushBox1(l *lua.State, val [2]float64) { - l.Global("box") - l.PushNumber(val[0]) - l.PushNumber(val[1]) - l.Call(2, 1) -} - -func luaPushBox2(l *lua.State, val [2][2]float64) { - l.Global("box") - luaPushVec2(l, val[0]) - luaPushVec2(l, val[1]) - l.Call(2, 1) -} - -func luaPushBox3(l *lua.State, val [2][3]float64) { - l.Global("box") - luaPushVec3(l, val[0]) - luaPushVec3(l, val[1]) - l.Call(2, 1) -} - -func luaPushColor(l *lua.State, val color.NRGBA) { - l.NewTable() - l.PushInteger(int(val.R)) - l.SetField(-2, "r") - l.PushInteger(int(val.G)) - l.SetField(-2, "g") - l.PushInteger(int(val.B)) - l.SetField(-2, "b") - l.PushInteger(int(val.A)) - l.SetField(-2, "a") -} - -func luaPushStringSet(l *lua.State, val []string) { - l.NewTable() - for _, str := range val { - l.PushBoolean(true) - l.SetField(-2, str) - } -} - -func luaPushStringList(l *lua.State, val []string) { - l.NewTable() - for i, str := range val { - l.PushString(str) - l.RawSetInt(-2, i+1) - } -} - -// i hate go for making me do this instead of just using luaPushStringList -// but i dont want to make an unsafe cast either -func luaPushTextureList(l *lua.State, val []mt.Texture) { - l.NewTable() - for i, str := range val { - l.PushString(string(str)) - l.RawSetInt(-2, i+1) - } -} |