Add Vector Types to Ona Script #34

Merged
kayomn merged 4 commits from kym-vector-types into main 2023-08-13 15:39:50 +02:00
1 changed files with 0 additions and 43 deletions
Showing only changes of commit af7483db13 - Show all commits

View File

@ -41,8 +41,6 @@ pub const RuntimeEnv = struct {
push_false,
push_const: u16,
push_local: u8,
push_vector2,
push_vector3,
push_table: u32,
push_builtin: Builtin,
local_set: u8,
@ -346,47 +344,6 @@ pub const RuntimeEnv = struct {
}
},
.push_vector2 => {
const x = try self.env.expect(try self.pop_local());
defer self.env.discard(x);
const y = try self.env.expect(try self.pop_local());
defer self.env.discard(y);
const vector = try self.env.new_vector2(
@floatCast(try self.env.unbox_float(x)),
@floatCast(try self.env.unbox_float(y)));
errdefer self.env.discard(vector);
try self.env.locals.push_one(vector);
},
.push_vector3 => {
const x = try self.env.expect(try self.pop_local());
defer self.env.discard(x);
const y = try self.env.expect(try self.pop_local());
defer self.env.discard(y);
const z = try self.env.expect(try self.pop_local());
defer self.env.discard(z);
const vector = try self.env.new_vector3(
@floatCast(try self.env.unbox_float(x)),
@floatCast(try self.env.unbox_float(y)),
@floatCast(try self.env.unbox_float(z)));
errdefer self.env.discard(vector);
try self.env.locals.push_one(vector);
},
.push_table => |push_table| {
const table = try self.env.new_table();