Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

size_t size mismatch in precompiled chunk. Unable to use loadfile to load precompiled lua bytecode.
Started by varscott16 Jul 08 2018 07:21 PM

- - - - -
5 replies to this topic
bytecode

Best Answer davebollinger , 09 July 2018 - 06:08 AM

Corona uses Lua 5.1.5

A chunk compiled with 5.3 will be incompatible.

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

varscott16

[GLOBAL: userInfoPane.html]
varscott16
  • Observer

  • 5 posts
  • Corona SDK

I have a simple lua script here:

local string = "Hello World"
print(string)

I have compiled this down to bytecode using luac53. However the problem arises when trying this:

local func = assert(loadfile("compiledlua.lua"))

This is where I get the:

"size_t size mismatch in precompiled chunk".

 

I really have no idea why this is happening. Can anyone help me?



[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 325 posts
  • Corona SDK

Hi varscott16, 

 

I tested your code on my computer (Win7 64bit with luarock with built-in lua5.1.exe and luac5.1.exe). It works as expected. 

 

Which version of lua interpreter do you use? Do both interpreter and compiler are for 64bit or 32bit systems?

 

 

ldurniat


  • varscott16 likes this

[TOPIC: post.html]
#3

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,138 posts
  • Enterprise

  Best Answer

Corona uses Lua 5.1.5

A chunk compiled with 5.3 will be incompatible.


  • varscott16 likes this

[TOPIC: post.html]
#4

varscott16

[GLOBAL: userInfoPane.html]
varscott16
  • Observer

  • 5 posts
  • Corona SDK

It was in fact a compatibility thing. The loadfile script works great when running from lua53.exe directly but my debugger in vscode was configured to use lua 5.1. Thank you guys for the help on this one!



[TOPIC: post.html]
#5

sidermaniac

[GLOBAL: userInfoPane.html]
sidermaniac
  • Observer

  • 23 posts
  • Corona SDK

Now that this has been answered I will ask why does the documentation say that loadfile()  is not available in Corona. 

From here at the end of the page.

 

 

The basic Lua library provides several core functions. For security reasons, the dofile()load()loadfile(), and loadstring() functions are not available in Corona.


[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,119 posts
  • Corona Staff

I know we enabled loadstring(), but for a long time Apple would reject apps that tried to dynamically load executable code. They have eased that restriction somewhat, but any of those API's we may have opened, but chose to not document them.

 

Rob


  • sidermaniac likes this


[topic_controls]
[/topic_controls]