Lua from svn repository - run examples

Hello!
I compiled Lua sources from this url:

svn.anyware-tech.com/wavecom/openat-lua/trunk

and some examples from here

svn.anyware-tech.com/wavecom/op … k/samples/

everything were compiled with success, but when I tried to run any example I get the following error:

[APP] start the VM

[LOG] [LUA] [DEBUG]: “Preloading package ad.core”

[LOG] [LUA] [DEBUG]: “Preloading package ad”

[LOG] [LUA] [DEBUG]: “Preloading package at.atpluslua”

[LOG] [LUA] [DEBUG]: “Preloading package at.commands”

[LOG] [LUA] [DEBUG]: “Preloading package at.core”

[LOG] [LUA] [DEBUG]: “Preloading package at”

[LOG] [LUA] [DEBUG]: “Preloading package base”

[LOG] [LUA] [DEBUG]: “Preloading package bearer.core”

[LOG] [LUA] [DEBUG]: “Preloading package bearer”

[LOG] [LUA] [DEBUG]: “Preloading package bit”

[LOG] [LUA] [DEBUG]: “Preloading package checks”

[LOG] [LUA] [DEBUG]: “Preloading package coxpcall”

[LOG] [LUA] [DEBUG]: “Preloading package debug”

[LOG] [LUA] [DEBUG]: “Preloading package delayedrun”

[LOG] [LUA] [DEBUG]: “Preloading package dlmalloc”

[LOG] [LUA] [DEBUG]: “Preloading package httpload”

[LOG] [LUA] [DEBUG]: “Preloading package inspect”

[LOG] [LUA] [DEBUG]: “Preloading package loadbuffer”

[LOG] [LUA] [DEBUG]: “Preloading package lock”

[LOG] [LUA] [DEBUG]: “Preloading package log”

[LOG] [LUA] [DEBUG]: “Preloading package log.platform”

[LOG] [LUA] [DEBUG]: “Preloading package luatobin”

[LOG] [LUA] [DEBUG]: “Preloading package ltn12”

[LOG] [LUA] [DEBUG]: “Preloading package math”

[LOG] [LUA] [DEBUG]: “Preloading package mime”

[LOG] [LUA] [DEBUG]: “Preloading package os”

[LOG] [LUA] [DEBUG]: “Preloading package package”

[LOG] [LUA] [DEBUG]: “Preloading package pipe”

[LOG] [LUA] [DEBUG]: “Preloading package print”

[LOG] [LUA] [DEBUG]: “Preloading package rawflash”

[LOG] [LUA] [DEBUG]: “Preloading package require”

[LOG] [LUA] [DEBUG]: “Preloading package sched”

[LOG] [LUA] [DEBUG]: “Preloading package sched.platform”

[LOG] [LUA] [DEBUG]: “Preloading package sched.timer”

[LOG] [LUA] [DEBUG]: “Preloading package shell”

[LOG] [LUA] [DEBUG]: “Preloading package sms.core”

[LOG] [LUA] [DEBUG]: “Preloading package sms”

[LOG] [LUA] [DEBUG]: “Preloading package socket.core”

[LOG] [LUA] [DEBUG]: “Preloading package socket”

[LOG] [LUA] [DEBUG]: “Preloading package socket.http”

[LOG] [LUA] [DEBUG]: “Preloading package socket.smtp”

[LOG] [LUA] [DEBUG]: “Preloading package socket.ftp”

[LOG] [LUA] [DEBUG]: “Preloading package socket.url”

[LOG] [LUA] [DEBUG]: “Preloading package socket.tp”

[LOG] [LUA] [DEBUG]: “Preloading package strict”

[LOG] [LUA] [DEBUG]: “Preloading package string”

[LOG] [LUA] [DEBUG]: “Preloading package table”

[LOG] [LUA] [DEBUG]: “Preloading package time”

[LOG] [LUA] [DEBUG]: “Preloading package uart”

[LOG] [LUA] [DEBUG]: “Preloading package varispeed”

[LOG] [LUA] [DEBUG]: “Preloading package watchdog”

[LOG] [LUA] [DEBUG]: “Preloading package wipsock.options”

[LOG] [LUA] [DEBUG]: “Preloading package pack”

[LOG] [flash] [DEBUG]: “loading flash chunk require”

[LOG] [luaw_loaders] [ERROR]: “Fatal error 3 while loading ‘require’: “require: bad header in precompiled chunk (0)””

Any Ideas what I’m doing wrong?
Thank you from advance!

Best regards
Chris

The reason is precompiled header mismatch. LuaW now includes LNUM patch. Use luac-oatlua4 to compile all library and project .lua sources and rebuild.

Hi!
In the beginning thanks for your reply!

It is a long time since I’ve asked my question, after that I’ve been moved to another project. So sorry for my late response.

I’ve checked your solution and it works (thank you very much!). The solution fixed the problem with “bad header in precompiled chunk”.

Unfortunately after that I encountered another problem. Now when lua is starting there is no error, but my Lua application doesn’t start, and the “at+lua=’’” command doesn’t work.

So I’ve done some investigations and I ascertained that function LUAW_PERFORM_LRUN (luaw_main.c) returns an error. The problem occurs during calling the following piece of code:

r = lua_pcall( L, 1, 0, 0);
	if( OK != r) {
		wip_debug(luaL_checkstring( L, -1));
		luaW_debug( "luaW_run", "ERROR", "Error %d when calling run(): \"%s\"", r, luaL_checkstring( L, -1));
		lua_pop( L, 1); /* pop error msg. */
		return r;
	}

The error message is: “…\kkb\fastrack\luanowa\trunk\oatlua\src-lua\sched.lua:127: attempt to call global ‘print’ (a nil value)”, and the function returns 2 instead of 0.

So I tried to temporarily define a print function in shed.lua. After that LUAW_PERFORM_LRUN returns 0 (OK), but my Lua application and “at+lua=’’” still doesn’t work.

Do you have any idea how to fix the problem?

Thank you in advance!
Chris

To use at+lua command you should:

require('atpluslua')

somewhere in initialization, prehaps in main.lua. The atpluslua.lua requires(‘print’) by itself.

If you already have that statement inluded, try look in lua debug traces, if atpluslua / print module is loaded successfully. So, modules are first preloaded and loaded later, when needed.