# Render.draw() expects matrix instead of table for options (SOLVED)

**URL:** <https://forum.defold.com/t/render-draw-expects-matrix-instead-of-table-for-options-solved/77812>\
**Category:** Bugs\
**Created:** [August 18, 2024, 10:04pm UTC](https://forum.defold.com/t/render-draw-expects-matrix-instead-of-table-for-options-solved/77812 "2024-08-18T22:04:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [August 18, 2024, 10:04pm UTC](https://forum.defold.com/t/render-draw-expects-matrix-instead-of-table-for-options-solved/77812/1 "2024-08-18T22:04:53Z")

</div>

I want to verify if this is a problem only for me?

If I use `render.draw` according to [the documentation](https://defold.com/ref/stable/render/#render.draw:predicate-%5Boptions%5D) the second argument should be a table with options, where I can define e.g. frustum and constants, but when I run my code today, I saw an error:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/1/1/118bd33eac74faeab5fc217a6ab8b220fa8c86bd.png)

```
render.draw(predicates.model, { frustum = camera_world.frustum })

```

Error:

```
ERROR:SCRIPT: render/cute.render_script:105: bad argument #5 to 'draw' (matrix4 expected, got table)
stack traceback:
[C]:-1: in function draw
render/cute.render_script:105: in function draw_function
render/helper.lua:165: in function with_material
render/cute.render_script:98: in function draw_function
render/helper.lua:153: in function to_render_target
render/cute.render_script:90: in function <render/cute.render_script:57>

```

Why it even points out argument #5?

It works (doesn’t show error), when I write:

```lua
    render.draw(predicates.model, camera_world.frustum)

```

Defold: 1.9.1 alpha  
Engine: 691478c02875b80e76da65d2f5756394e7a906b1

---

<div class="post-metadata">

**Author:** ![Wolfe2x7](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/wolfe2x7/32/35459_2.png) [@Wolfe2x7](https://forum.defold.com/u/Wolfe2x7)\
**Post date:** [August 19, 2024, 12:17am UTC](https://forum.defold.com/t/render-draw-expects-matrix-instead-of-table-for-options-solved/77812/2 "2024-08-19T00:17:18Z")

</div>

Argument #5 is `camera_world.frustum`, which is a table. If this render script you’re using still uses the old naming convention, `frustum` is the name of the options table, not the frustum matrix. The matrix is normally `camera_world.frustum.frustum`.

To avoid confusion between the table and matrix, I renamed the options table to `opts` in my render scripts. 👍

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [August 19, 2024, 6:29am UTC](https://forum.defold.com/t/render-draw-expects-matrix-instead-of-table-for-options-solved/77812/3 "2024-08-19T06:29:24Z")

</div>

Thank you, this was precisely my issue, indeed frustum was an options table, that’s why `render.draw(predicates.model, camera_world.frustum)` works 😃 And here’s a fix for what I needed (then I can also add constants):

```
render.draw(predicates.model, { frustum = camera_world.frustum.frustum })

```

> [@Wolfe2x7](#):
>
> To avoid confusion between the table and matrix, I renamed the options table to `opts` in my render scripts. 👍

Good tip!
