2024-07-21 15:37:08 +00:00
|
|
|
//go:build !midnight
|
2024-07-19 20:54:15 +00:00
|
|
|
package moonlight
|
|
|
|
|
|
|
|
import (
|
|
|
|
rt "github.com/arnodel/golua/runtime"
|
|
|
|
)
|
|
|
|
|
2024-07-21 15:37:08 +00:00
|
|
|
var NilValue = rt.NilValue
|
|
|
|
|
2024-07-19 20:54:15 +00:00
|
|
|
type Value = rt.Value
|
2024-07-20 18:49:43 +00:00
|
|
|
type ValueType = rt.ValueType
|
|
|
|
const (
|
2024-07-21 15:37:08 +00:00
|
|
|
IntType = rt.IntType
|
2024-07-20 18:49:43 +00:00
|
|
|
StringType = rt.StringType
|
|
|
|
FunctionType = rt.FunctionType
|
2024-07-20 19:11:45 +00:00
|
|
|
TableType = rt.TableType
|
2024-07-20 18:49:43 +00:00
|
|
|
)
|
2024-07-19 20:54:15 +00:00
|
|
|
|
2024-07-21 15:37:08 +00:00
|
|
|
func Type(v Value) ValueType {
|
|
|
|
return ValueType(v.Type())
|
|
|
|
}
|
|
|
|
|
2024-07-19 20:54:15 +00:00
|
|
|
func StringValue(str string) Value {
|
|
|
|
return rt.StringValue(str)
|
|
|
|
}
|
|
|
|
|
2024-07-21 15:40:13 +00:00
|
|
|
func IntValue(i int64) Value {
|
|
|
|
return rt.IntValue(i)
|
2024-07-19 20:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func BoolValue(b bool) Value {
|
|
|
|
return rt.BoolValue(b)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TableValue(t *Table) Value {
|
|
|
|
return rt.TableValue(t.lt)
|
|
|
|
}
|
2024-07-20 18:49:43 +00:00
|
|
|
|
2024-07-20 19:11:45 +00:00
|
|
|
func ToString(v Value) string {
|
|
|
|
return v.AsString()
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToTable(v Value) *Table {
|
|
|
|
return convertToMoonlightTable(v.AsTable())
|
|
|
|
}
|
2024-07-21 15:37:08 +00:00
|
|
|
|
|
|
|
func AsValue(v interface{}) Value {
|
|
|
|
return rt.AsValue(v)
|
|
|
|
}
|