Documentation
¶
Index ¶
- func FromGo(v interface{}) object.Object
- func MustParseJSON(jsonStr string) object.Object
- func ParseJSON(jsonStr string) (object.Object, error)
- func ToBytes(obj object.Object) ([]byte, object.Object)
- func ToGo(obj object.Object) interface{}
- func ToGoError(obj object.Object) error
- func ToGoWithError(obj object.Object) (interface{}, *object.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromGo ¶
FromGo converts a Go interface{} value to a scriptling Object. It handles primitive types (nil, bool, int, float, string), nested structures (maps, slices), and falls back to JSON marshaling for unknown types.
func MustParseJSON ¶
MustParseJSON parses a JSON string and returns a Scriptling object, returning an Error object if parsing fails.
func ParseJSON ¶
ParseJSON parses a JSON string and returns a Scriptling object. It uses UseNumber() to preserve large integers.
func ToBytes ¶ added in v0.19.0
ToBytes accepts a Bytes or String input and returns the raw byte slice. Used by libraries that historically took strings but now also accept Bytes (file I/O, HTTP bodies, socket send, etc.). Returns a Scriptling *Error object for any other type so callers can return it directly.
Bytes are returned as-is (no copy — treat the result as read-only). Strings are UTF-8 encoded into a fresh byte slice.
func ToGo ¶
ToGo converts a scriptling Object to a Go interface{}. It returns the underlying Go value for the object type.
Types ¶
This section is empty.