conversion

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromGo

func FromGo(v interface{}) object.Object

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

func MustParseJSON(jsonStr string) object.Object

MustParseJSON parses a JSON string and returns a Scriptling object, returning an Error object if parsing fails.

func ParseJSON

func ParseJSON(jsonStr string) (object.Object, error)

ParseJSON parses a JSON string and returns a Scriptling object. It uses UseNumber() to preserve large integers.

func ToGo

func ToGo(obj object.Object) interface{}

ToGo converts a scriptling Object to a Go interface{}. It returns the underlying Go value for the object type.

func ToGoError

func ToGoError(obj object.Object) error

ToGoError converts a scriptling Object to a Go error. If the object is an Error type, it returns a Go error with the error message. Otherwise, it returns nil.

func ToGoWithError

func ToGoWithError(obj object.Object) (interface{}, *object.Error)

ToGoWithError converts a Scriptling object to a Go value, returning error for complex types

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL