Index: /trunk/core/luascript.c
===================================================================
--- /trunk/core/luascript.c	(revision 519)
+++ /trunk/core/luascript.c	(revision 520)
@@ -660,17 +660,27 @@
 {
   int addr = (luaL_checknumber(L,1));
-  lua_pushnumber( L, *(unsigned *)(addr) );
-  return 1;
-}
-
-#if 0
+  // must be alligned
+  if (addr & 0x3) {
+  	lua_pushnil(L);
+  }
+  else {
+    lua_pushnumber( L, *(unsigned *)(addr) );
+  }
+  return 1;
+}
+
 static int luaCB_poke( lua_State* L )
 {
   int addr = (luaL_checknumber(L,1));
   int val = (luaL_checknumber(L,2));
-  *(unsigned *)(addr) = val;
-  return 0;
-}
-#endif
+  if (addr & 0x3) {
+  	lua_pushnil(L);
+  }
+  else {
+    *(unsigned *)(addr) = val;
+    lua_pushboolean(L,1);
+  }
+  return 1;
+}
 
 static int luaCB_bitand( lua_State* L )
@@ -726,4 +736,22 @@
   unsigned val = (luaL_checknumber(L,1));
   lua_pushnumber( L, ~val );
+  return 1;
+}
+
+static void set_string_field(lua_State* L, const char *key, const char *val)
+{
+  lua_pushstring(L, val);
+  lua_setfield(L, -2, key);
+}
+
+static int luaCB_get_buildinfo( lua_State* L )
+{
+  lua_createtable(L, 0, 6);  /* 9 = number of fields */
+  set_string_field( L,"platform", PLATFORM );
+  set_string_field( L,"platsub", PLATFORMSUB );
+  set_string_field( L,"version", HDK_VERSION );
+  set_string_field( L,"build_number", BUILD_NUMBER );
+  set_string_field( L,"build_date", __DATE__ );
+  set_string_field( L,"build_time", __TIME__ );
   return 1;
 }
@@ -841,7 +869,5 @@
   FUNC(get_temperature);
   FUNC(peek);
-#if 0
   FUNC(poke);
-#endif
   FUNC(bitand);
   FUNC(bitor);
@@ -853,3 +879,5 @@
 
   FUNC(get_time);
-}
+
+  FUNC(get_buildinfo);
+}
Index: /trunk/version.inc
===================================================================
--- /trunk/version.inc	(revision 519)
+++ /trunk/version.inc	(revision 520)
@@ -1,1 +1,1 @@
-BUILD_NUMBER := 0.5.2
+BUILD_NUMBER := 0.5.3
Index: /trunk/script/llibtst.lua
===================================================================
--- /trunk/script/llibtst.lua	(revision 519)
+++ /trunk/script/llibtst.lua	(revision 520)
@@ -419,5 +419,8 @@
 
 io.output(testlog)
+bi=get_buildinfo()
 log("test log opened\n");
+log("platform: ",bi.platform," ",bi.platsub,"\n")
+log("version: ",bi.version," ",bi.build_number," built on ",bi.build_date," ",bi.build_time,"\n")
 if do_io then
 	io_test()
Index: /trunk/doc/version.txt
===================================================================
--- /trunk/doc/version.txt	(revision 519)
+++ /trunk/doc/version.txt	(revision 520)
@@ -5,4 +5,13 @@
 
 log
+0.5.3 / reyalp
++ added lua function get_buildinfo.  Returns a table:
+  { platform,platsub,version,build_number,build_date,build_time }
+* enabled lua poke. sets word at address to value.
+  result=poke(address,value) 
+  returns nil if the address is not aligned, otherwise true
+* changed peek and poke to return nil if given a non-aligned address
+* changed llibtst.lua to record build info
+
 0.5.2 / reyalp
 + added CHDK/LUALIB, update version
