-/* Copyright (c) 2010. The SimGrid Team.
+/* Copyright (c) 2010-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
break;
}
- indent -= 2;
XBT_DEBUG("%sData copied", sglua_get_spaces(indent));
sglua_stack_dump("src after copying a value (should be ... value): ", src);
* @brief Copies the function on the top of src to the top of dst.
*
* It can be a Lua function or a C function.
- * Copying upvalues is not implemented yet.
*
* @param src source state
* @param dst destination state
buffer.size = 0;
buffer.data = xbt_new(char, buffer.capacity);
- /* copy the binary chunk from src into a buffer */
- _XBT_GNUC_UNUSED int error = lua_dump(src, sglua_memory_writer, &buffer);
+ /* copy the binary chunk from src into a buffer
+ * c.heinrich: Added parameter TRUE for Lua 5.3 - this strips all debug
+ * information from the function.
+ */
+ // Was before merge: XBT_GNUC_UNUSED and was replaced with XBT_ATTRIB_UNUSED
+ XBT_ATTRIB_UNUSED int error = lua_dump(src, sglua_memory_writer, &buffer, TRUE);
xbt_assert(!error, "Failed to dump the function from the source state: error %d",
error);
XBT_DEBUG("Fonction dumped: %zu bytes", buffer.size);
/* copy the data */
/* src: ... udata
dst: ... */
- size_t size = lua_objlen(src, -1);
+ size_t size = lua_rawlen(src, -1);
void* src_block = lua_touserdata(src, -1);
void* dst_block = lua_newuserdata(dst, size);
/* dst: ... udata */
/* want a global or a registry value? */
int pseudo_index;
- if (lua_equal(L, 1, LUA_REGISTRYINDEX)) {
+ if (lua_compare(L, 1, LUA_REGISTRYINDEX, LUA_OPEQ)) {
/* registry */
pseudo_index = LUA_REGISTRYINDEX;
XBT_DEBUG("Will get the value from the registry of maestro");
}
else {
/* global */
- pseudo_index = LUA_GLOBALSINDEX;
+ pseudo_index = lua_getfield(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
XBT_DEBUG("Will get the value from the globals of maestro");
}
lua_setmetatable(L, -2); /* thread newenv mt reg */
lua_pop(L, 1); /* thread newenv mt */
lua_setmetatable(L, -2); /* thread newenv */
- lua_setfenv(L, -2); /* thread */
+ // TODO c.heinrich This needs to be re-implemented
+ /*lua_setfenv(L, -2); [> thread <]*/
lua_pop(L, 1); /* -- */
/* create the table of known tables from maestro */