mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Add a basic managment of obisequenceslice to obiscript
Former-commit-id: c3d2888ebbfb237826630548b839ce93cdbf86eb
This commit is contained in:
@ -146,25 +146,6 @@ func pushMapStringFloat64ToLua(L *lua.LState, m map[string]float64) {
|
||||
L.Push(luaTable)
|
||||
}
|
||||
|
||||
// pushSliceIntToLua creates a new Lua table and sets the elements of a Go slice in the Lua table. Then, it pushes the Lua table onto the stack.
|
||||
//
|
||||
// L *lua.LState, slice []int
|
||||
// None
|
||||
func pushSliceIntToLua(L *lua.LState, slice []int) {
|
||||
// Create a new Lua table
|
||||
luaTable := L.NewTable()
|
||||
|
||||
// Iterate over the Go slice and set the elements in the Lua table
|
||||
for _, value := range slice {
|
||||
// Append the value to the Lua table
|
||||
// Lua is 1-indexed, so we use the length of the table + 1 as the next index
|
||||
luaTable.Append(lua.LNumber(value))
|
||||
}
|
||||
|
||||
// Push the Lua table onto the stack
|
||||
L.Push(luaTable)
|
||||
}
|
||||
|
||||
func pushSliceNumericToLua[T float64 | int | byte](L *lua.LState, slice []T) {
|
||||
// Create a new Lua table
|
||||
luaTable := L.NewTable()
|
||||
@ -215,21 +196,3 @@ func pushSliceBoolToLua(L *lua.LState, slice []bool) {
|
||||
// Push the Lua table onto the stack
|
||||
L.Push(luaTable)
|
||||
}
|
||||
|
||||
// pushSliceFloat64ToLua creates a new Lua table and pushes it onto the stack.
|
||||
//
|
||||
// L *lua.LState - the Lua state
|
||||
// slice []float64 - the Go slice to be inserted into the Lua table
|
||||
func pushSliceFloat64ToLua(L *lua.LState, slice []float64) {
|
||||
// Create a new Lua table
|
||||
luaTable := L.NewTable()
|
||||
|
||||
// Iterate over the Go slice and insert each float64 into the Lua table
|
||||
for _, value := range slice {
|
||||
// Lua is 1-indexed, so we append the value to the Lua table
|
||||
luaTable.Append(lua.LNumber(value))
|
||||
}
|
||||
|
||||
// Push the Lua table onto the stack
|
||||
L.Push(luaTable)
|
||||
}
|
||||
|
Reference in New Issue
Block a user