Jittering on client when using resource exports

Happens when using a function through the export feature on client side scripts. Moving the code into a single file removed the jitter.

This file has the function parseMenu() which is exported in the __resource.lua file. and called from gui.lua.

My client connected to the server “jitters” or seems to skip frames without the framerate actually lowering. I even lowered settings to 720p and in windowed mode to make sure it was not my computer underperforming. The jittering was consistent between any video settings.

Moving the code from menu.lua into gui.lua and calling the function locally removed the jitter so I’m certain this is something to do with exports. Maybe from passing a large table?

You’re creating and marshaling a huge table across Lua VMs every single game frame. Try refactoring your code so you don’t have to call your export every single frame.

As a hint, your export can return a table that contains functions, and these will be marshaled as callables that will call back into the original resource.