Search found 2 matches

by Imagic
Thu Nov 07, 2019 4:20 pm
Forum: Support and Development
Topic: Passing a 'self' function as a parameter
Replies: 4
Views: 1002

Re: Passing a 'self' function as a parameter

Code: Select all

square:increment(...)
is syntactic sugar for

Code: Select all

square.increment(square, ...)

methods are functions and self is not a property of a function, it's a parameter (https://www.lua.org/manual/5.1/manual.html#2.5.8).

Based on that, you may be able to redesign your code.
by Imagic
Mon Sep 30, 2019 8:25 am
Forum: Support and Development
Topic: Speed of getters/setters as opposed to average variable access?
Replies: 3
Views: 1292

Re: Speed of getters/setters as opposed to average variable access?

raidho36 wrote:
Mon Sep 30, 2019 6:49 am
Note that Lua nor LuaJIT in particular will inline your trivial getters and setters like C++ would, and using those over direct access would be slower, for no reason.
The JIT can inline calls, but in this case the C call will prevent the trace to be compiled (LuaJIT 2.0).