From: [https://nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-operator](https://nim-lang.org/docs/manual.html#statements-and-expressions-the-addr-operator)
> The addr operator returns the address of an l-value. From: [https://nim-lang.org/docs/manual.html#procedures-var-return-type](https://nim-lang.org/docs/manual.html#procedures-var-return-type) > A proc, converter or iterator may return a var type which means that the > returned value is an l-value and can be modified by the caller: In other words, when a return type is not a var type, it is not an l-value. From: [https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA](https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA) [https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA_2](https://nim-lang.org/docs/tables.html#%5B%5D%2CTable%5BA%2CB%5D%2CA_2) > proc `[]`[A, B](t: Table[A, B]; key: A): B > > proc `[]`[A, B](t: var Table[A, B]; key: A): var B So in your `CreateBuffers` proc, `proc `[]`[A, B](t: Table[A, B]; key: A): B` is called and it doesn't return var type. You can get an address only from an l-value. That is why you cannt use `unsafeAddr` in your code. You can not access `seq[0]` when the lenght of the sequence is 0. I think your code shoulde be like: proc CreateBuffers*(obj: var RenderableObject) {.inline.} = # # # glBufferData(GL_ARRAY_BUFFER, obj.vertices_tbl[f].len*sizeof(GLfloat), if obj.vertices_tbl[f].len == 0: nil else: obj.vertices_tbl[f][0].unsafeAddr, GL_STATIC_DRAW) Run > if I pass it with var like obj: var RenderableObject it works, but that kinda > defeats the purpose of using tables and its very slow I don't understand neither why you are using tables in your code nor why `var` defeats the purpose of using tables only from your code.
