Newer
Older
Tardis / lang / list.h
// SPDX-License-Identifier: MIT
// Copyright (c) 2024 John Watts and the LuminaSensum contributors

#ifndef LIST_H
#define LIST_H

#include "types.h"

// Creates a list of objects with a specific length
// All objects are initialized to object_none
Object object_list_create(VmState state, int length);

// Gets the length of an object list
int object_list_length(VmState state, Object list);

// Sets an element in the object list
// The object's reference is taken from the caller
void object_list_set(VmState state, Object list, int index, Object obj);

// Gets an element from the object list
// A new reference is created for the caller
Object object_list_get(VmState state, Object list, int index);

Object object_list_copy(VmState state, Object list);

#endif